正式区复制到测试区


1.复制程序(覆盖后需将$TOP/bin目录还原,因其下面有tiptop的注册信息)
su -
cd /u1/topprod
tar czvf /u3/prod.tgz tiptop topcust
cd /u1/toptest
tar czvf /u3/test.tgz tiptop topcust
cd /u1/toptest/tiptop
tar czvf bin.tgz bin
cd /u1/toptest
tar xzvf /u3/prod.tgz
cd tiptop
tar xzvf bin.tgz

2.复制DB

方法1:(了解RMAN克隆数据库的内容)
用RMAN克隆的方式,将topprod数据库复制到toptest数据库,topprod实例需视数据库大小关闭30~60分钟。
su - tiptop
rman target=/
rman>shutdown immediate;
rman>startup mount;
rman>backup database;

su - toptest
rman target=/
rman>shutdown immediate;
rman>create pfile from spfile;

gzip toptest-spfile;
vi toptest-pfile;

在toptest数据库参数文件pfile上加下面的语句,保存退出
db_file_name_convert='topprod','toptest'
log_file_name_convert='topprod','toptest'

rman target=sys/sys@topprod AUXILIARY=/
RUN{
DUPLICATE TARGET DATABASE TO toptest
LOGFILE
GROUP 1 ('/u2/oradb/oradata/toptest/redo01.log') size 50M,
GROUP 2 ('/u2/oradb/oradata/toptest/redo02.log') size 50M,
GROUP 3 ('/u2/oradb/oradata/toptest/redo03.log') size 50M;
}


方法2:(仅对GP51有效)
以ds1为例,其他db都是相同做法
先用toptest登录:su - toptest
删除ds1:sqlplus system/passwd@toptest
drop user ds1 cascade;
退出sqlplus,创建ds1:createdb ds1 1
复制正式区的ds1数据:imp ds1/ds1 file=ds1.dmp full=y ignore=y
(ds1.dmp是正式区ds1的备份文件,可在/u3/exp下面找,找最新的,昨晚的备份)


3.复制CR报表模板
mv d:\Tiptop_CR\toptest d:\Tiptop_CR\toptest_bak20110201
cp d:\Tiptop_CR\topprod d:\Tiptop_CR\toptest