DBCA建立空的(恢复)目标库的时候,请注意填写数据库名称那一页,需要点击"Create As Container
Database"建立一个空的Container Database 或含有一个或多个PDBs的Container Database, 否则后面在
恢复的时候会报错 ora-65093: container database not set up properly 。提示这个不是一个12c CDB
数据库,而只是一个普通的12C数据库。目前的版本下,普通的12c数据库不能转化为容器数据库。
a. 根据源数据库上datafile路径编写set newname的脚本,保存为 recover_alldb.sql
select 'set newname for datafile '''||name||''' to '''||name||''' ;' from v$datafile;
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
set newname for datafile '/data01/oracle12c/oradata/test12c/system01.dbf' to '/data01/oracle12c/oradata/test12/system01.dbf' ;
...... 包括所有CDB和PDBs的数据文件,不包括temp及redo文件 。
set newname for datafile '/data01/oracle12c/oradata/test12c/mypdb1/sysaux01.dbf' to '/data01/oracle12c/oradata/test12/mypdb1/sysaux01.dbf' ;
set newname for datafile '/data01/oracle12c/oradata/test12c/mypdb1/hw001.dbf' to '/data01/oracle12c/oradata/test12/mypdb1/hw001.dbf' ;
restore database force;
switch datafile all;
release channel c1;
release channel c2;
release channel c3;
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-1103157/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/35489/viewspace-1103157/