【XTTS】Oracle传输表空间xtts增量方式-创新互联
--在线传输表空间,增量方式 --创建相关目录 create directory sourcedir as '+DATA/mydb/datafile'; create directory destdir as '/oracle/app/oracle/oradata/mytest'; --创建dblink create public database link ttslink connect to system identified by oracle using 'mydb'; select * from dual@ttslink; export TMPDIR=/home/oracle/xtt mkdir -p /stage_source chown oracle:oinstall /stage_source scp -r/home/oracle/xtt mystandby:/home/oracle --相关表空间 TEST,MYDB,TMOVE,TBSADD,TSB01 tablespaces= ----需要迁移的表空间 platformid= ----源 OS 平台 ID dfcopydir= ----源数据库备份文件存放目录 backupformat= ---源数据库增备文件存放目录 stageondest= ----目标据库备份文件存放目录 storageondest= ----目标据库正式文件存放目录 backupondest= ----目标据库增备文件存放目录 parallel= ----备份,转化的并行度 rollparallel= ----增备的并行度 getfileparallel= ---- 使用 dbms_file_transfer 方式的并行度 --源端块跟踪 alter database enable block change tracking using file '+data'; --源端运行,导出数据 export TMPDIR=/home/oracle/xtt $ORACLE_HOME/perl/bin/perl xttdriver.pl -p --nfs /stage_source 192.168.8.0/24(rw,no_root_squash,no_all_squash,sync) exportfs -r service rpcbind start service nfs start mount -t nfs -o rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0,vers=3,timeo=600 192.168.8.24:/stage_source /stage_dest --挂在的nfs,无需拷贝 --scp oracle@source:/stage_source/* /stage_dest cd /home/oracle/xtt/ scp rmanconvert.cmd mystandby:/home/oracle/xtt --chown -R oracle:oinstall /stage_dest/* export TMPDIR=/home/oracle/xtt $ORACLE_HOME/perl/bin/perl xttdriver.pl -c --源端创建增量备份 export TMPDIR=/home/oracle/xtt $ORACLE_HOME/perl/bin/perl xttdriver.pl -i --nfs无需拷贝 --scp `cat incrbackups.txt` oracle@dest:/stage_dest cd /home/oracle/xtt/ scp xttplan.txt mystandby:/home/oracle/xtt scp tsbkupmap.txt mystandby:/home/oracle/xtt --目标端 export ORACLE_SID=mytest export TMPDIR=/home/oracle/xtt $ORACLE_HOME/perl/bin/perl xttdriver.pl -r --源端更新scn $ORACLE_HOME/perl/bin/perl xttdriver.pl -s --目标端创建相关用户,注意密码即将过期用户无法查到(open) select 'create user '||d.username||' identified by values '''||u.password||''' default tablespace USERS temporary tablespace '||d.TEMPORARY_TABLESPACE||';' from dba_users d,user$ u where d.username=u.name and account_status='OPEN' and username not in('SYS','SYSTEM'); select 'grant '||granted_role||' to '||grantee||';' from dba_role_privs where grantee in (select username from dba_users where account_status='OPEN' and username not in('SYS','SYSTEM')) union select 'grant '||PRIVILEGE||' to '||grantee||';' from DBA_SYS_PRIVS where grantee in (select username from dba_users where account_status='OPEN' and username not in('SYS','SYSTEM')); --源端设置表空间只读TEST,MYDB,TMOVE,TBSADD,TSB01 alter tablespace TEST read only; alter tablespace MYDB read only; alter tablespace TMOVE read only; alter tablespace TBSADD read only; alter tablespace TSB01 read only; --最后增量 --源端创建增量备份,注意nfs目录权限 chown -R oracle:oinstall /stage_source export TMPDIR=/home/oracle/xtt $ORACLE_HOME/perl/bin/perl xttdriver.pl -i --nfs无需拷贝,incrbackups.txt 备份信息 --scp `cat incrbackups.txt` oracle@dest:/stage_dest cd /home/oracle/xtt/ scp xttplan.txt tsbkupmap.txt mystandby:/home/oracle/xtt --目标端 su - root chown -R oracle:oinstall /stage_dest/ su - oracle export ORACLE_SID=mytest export TMPDIR=/home/oracle/xtt $ORACLE_HOME/perl/bin/perl xttdriver.pl -r --生成导入脚本 $ORACLE_HOME/perl/bin/perl xttdriver.pl -e --编辑导入脚本,例如 impdp directory=DATA_PUMP_DIR logfile=tts_imp.log \ network_link=ttslink transport_full_check=no \ transport_tablespaces=ABC \ transport_datafiles='/oracle/app/oracle/oradata/mytest/ABC_12.dbf' --设置表空间读写 alter tablespace TEST read write; alter tablespace MYDB read write; alter tablespace TMOVE read write; alter tablespace TBSADD read write; alter tablespace TSB01 read write; --修改目标端用户默认表空间(语句在源端查询) select 'alter user '||d.username||' default tablespace '||d.default_tablespace||' temporary tablespace '||d.TEMPORARY_TABLESPACE||';' from dba_users d,user$ u where d.username=u.name and account_status='OPEN' and username not in('SYS','SYSTEM'); --取消块跟踪 alter database disable block change tracking; --删除dblink drop database link ttslink; --参考 /tupian/20230522/xtts.html /tupian/20230522/79460198 11G - Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Doc ID 1389592.1) /tupian/20230522/129601“只有客户发展了,才有我们的生存与发展!”这是创新互联的服务宗旨!把网站当作互联网产品,产品思维更注重全局思维、需求分析和迭代思维,在网站建设中就是为了建设一个不仅审美在线,而且实用性极高的网站。创新互联对成都网站制作、成都网站建设、外贸营销网站建设、网站制作、网站开发、网页设计、网站优化、网络推广、探索永无止境。
名称栏目:【XTTS】Oracle传输表空间xtts增量方式-创新互联
网站地址:http://scjbc.cn/article/djejss.html