數據庫遷移腳本

在50.6上導dmp文件步驟
su - oracle
imp file=/tmp/sps_dev_20150701.dmp log=/tmp/imp.log grants=N indexes=Y rows=Y full=Y userid=SXZQ/SXZQ@ORCL

查看對象select count(*) from user_objects
查看錶總數select count(*) from user_tables

查看錶空間使用情況
SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE,
(B.BYTES*100)/A.BYTES "% USED",(C.BYTES*100)/A.BYTES "% FREE"
FROM SYS.SM$TS_AVAIL A,SYS.SM$TS_USED B,SYS.SM$TS_FREE C
WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME AND A.TABLESPACE_NAME=C.TABLESPACE_NAME; 

exp spsv601/spsv106@spststdb_v6 file=D:\gxyjdb20130813.dmp owner=(spsv601)
--1. 當前表空間,文件最大限制爲4G
create   tablespace SPS_DATA       
datafile   'D:\oracle\product\10.2.0\oradata\orcl\SPS_DATA.DBF'   size   3000M   
autoextend   on   
next   200M   
maxsize   12000M;

--2.歸檔表空間
create   tablespace SPS_DATAARC       
datafile   'D:\oracle\product\10.2.0\oradata\orcl\SPS_DATAARC.DBF'   size   1000M   
autoextend   on   
next   200M   
maxsize   12000M;

--3.歷史表空間
create   tablespace SPS_DATAHIS       
datafile   'D:\oracle\product\10.2.0\oradata\orcl\SPS_DATAHIS.DBF'   size   1000M   
autoextend   on   
next   200M   
maxsize   12000M;

--4.索引表空間
create   tablespace SPS_INDX       
datafile   'D:\oracle\product\10.2.0\oradata\orcl\SPS_INDX.DBF'   size   1000M   
autoextend   on   
next   200M   
maxsize   12000M;
--5.索引歸檔表空間
create   tablespace SPS_INDXARC       
datafile   'D:\oracle\product\10.2.0\oradata\orcl\SPS_INDXARC.DBF'   size   1000M   
autoextend   on   
next   200M   
maxsize   12000M;

--6.索引歷史表空間
create   tablespace SPS_INDXHIS       
datafile   'D:\oracle\product\10.2.0\oradata\orcl\SPS_INDXHIS.DBF'   size   1000M   
autoextend   on   
next   200M   
maxsize   12000M;

--7.臨時表空間

--8.索引歷史表空間
create   tablespace DATA       
datafile   'D:\oracle\product\10.2.0\oradata\orcl\DATA.DBF'   size   1000M   
autoextend   on   
next   200M   
maxsize   12000M;


create   user   spsv60   
identified   by   spsv06   
default   tablespace   SPS_DATA   
temporary   tablespace   temp;


grant create session to spsv60   
grant dba to spsv60


create   user   spsv60his
identified   by   spsv60his
default   tablespace   SPS_DATAHIS
temporary   tablespace   temp;

grant create session to spsv60his;
grant dba to spsv60his;


導數據
imp file=F:\BaiduYunDownload\sxdxcheshi20141018\sxdxcheshi20141018.dmp log=F:\sxtcdb20141010\imp.log grants=N indexes=Y rows=Y full=Y userid=spsv60/spsv06@orcl

imp file=F:\sxtcdb20141010\sxtc.dmp log=F:\sxtcdb20141010\imp.log userid=spsv60/spsv06@orcl tables=(inter_service_order)

imp file=.\spsv60his.dmp log=./imp.log grants=N indexes=Y rows=Y full=Y userid=spsv60his/spsv60his@orcl


imp userid=spsv/[email protected] F:\Workspaces\dmp\all_his_tables.dmp log=F:\imp.log full=y

ALTER TABLESPACE SPS_INDXHIS ADD DATAFILE
'D:\oracle\product\10.2.0\oradata\orcl\SX_SPS_INDXHIS1.DBF'
SIZE 2G;

給表空間增加數據文件
ALTER TABLESPACE SPS_DATA  ADD DATAFILE
'D:\oracle\product\10.2.0\oradata\orcl\SPS_DATA01.DBF'
SIZE 2G;
增加表空間大小
ALTER TABLESPACE SPS_DATA ADD DATAFILE
'D:\oracle\product\10.2.0\oradata\orcl\SX_SPS_DATA2.DBF'
size   1000M   
autoextend   on   
next   200M   
maxsize   12000M;


查看錶空間目錄
select * from dba_data_files where tablespace_name='SPS_DATA'; 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章