SAP系统拷贝 UNIX + Oracle
拟将生产机PRD(sapprd)拷贝到测试机DEV(sapdev),步骤如下:
1. 生产机PRD
# su – prdadm
# stopsap r3
# exit
# su – oraprd
# sqlplus /nolog
SQLPLUS> connect /as sysdba
SQLPLUS> alter database backup controlfile to trace;
SQLPLUS> exit
# exit
# su – prdadm
# stopsap db
在目录/oracle/PRD/saptrace/usertrace/查找最新的*.trc文件,拷贝到文件control.sql,并进行编辑:
1. 只保留STARTUP MOUNT到CHARACTER SET WE8DEC;之间的语句,删除其它语句;
2. 查找替换PRD为DEV(%s/PRD/DEV/g);
3. 更改下面的语句
CREATE CONTROLFILE REUSE DATABASE ‘DEV’ NORESETLOGS ARCHIVELOG;
到
CREATE CONTROLFILE REUSE SET DATABASE ‘DEV’ RESETLOGS ARCHIVELOG;
2. 测试机DEV
# su – devadm
# stopsap all
# exit
# su – oradev
# lsnrctl stop
# exit
# cd /oracle/DEV/
# rm –rf sapdata?/*
# rm –rf origlog?/*
# rm –rf mirrlog?
# rm –rf sapreorg/*
# rm –rf saparch/*
# rm –rf saptrace/usertrace/*
# rm –rf saptrace/background/*
# rm –rf sapbackup/*
# rm –rf sapcheck/*
从生产机上拷贝control.sql
# rcp sapprd: /oracle/PRD/saptrace/usertrace/control.sql ./
从生产机上拷贝数据库data文件
# rcp –r sapprd:/oracle/PRD/sapdata? ./
#chown –R oradev:dba *
(也可以从备份中恢复相关文件)
#cd origlogA
#mkdir cntrl
#cd ../saparch
#mkdir cntrl
生成control文件
# su – oradev
# sqlplus /nolog
SQLPLUS> connect /as sysdba
SQLPLUS>@/oracle/DEV/control.sql
SQLPLUS>alter database open resetlogs;
SQLPLUS> exit
# lsnrctl start
启动sap,接下来就是sap里面的配置了。