您的位置:首页 > 科技 > 能源 > oracle使用backup as copy方式迁移数据文件
oracle使用backup as copy方式迁移数据文件
2024/11/30 9:42:51 来源:https://blog.csdn.net/lee_vincent1/article/details/140685830
浏览:
次
关键词:oracle使用backup as copy方式迁移数据文件
oracle使用backup as copy方式迁移数据文件
1 基础环境
--确认数据文件路径set line 200
col name for a75
selectfile#,name from v$datafileFILE# NAME---------- ---------------------------------------------------------------------------1/u01/app/oracle/oradata/ORCL/system01.dbf3/u01/app/oracle/oradata/ORCL/sysaux01.dbf4/u01/app/oracle/oradata/ORCL/undotbs01.dbf5/u01/app/oracle/oradata/ORCL/test.dbf7/u01/app/oracle/oradata/ORCL/users01.dbf--目标路径(确认目标路径的所属)/oradata/ORCL[root@test~]# ll /oradata/
total 0
drwxrwxr-x 2 oracle oinstall 6 Jul 2502:37 ORCL
2 重新起库到mount状态
SQL> shu immediate
SQL> startup mount;
3 backup as copy 方式改路径
rman target /backupas copy datafile 1 format '/oradata/ORCL/system01.dbf';backupas copy datafile 3 format '/oradata/ORCL/sysaux01.dbf';backupas copy datafile 4 format '/oradata/ORCL/undotbs01.dbf';backupas copy datafile 5 format '/oradata/ORCL/test.dbf';backupas copy datafile 7 format '/oradata/ORCL/users01.dbf';switch datafile 1to copy;
switch datafile 3to copy;
switch datafile 4to copy;
switch datafile 5to copy;
switch datafile 7to copy;
4 确认文件路径是否是目标路径
SQL>set line 200SQL> col name for a75
SQL>selectfile#,name from v$datafile;FILE# NAME---------- ---------------------------------------------------------------------------1/oradata/ORCL/system01.dbf3/oradata/ORCL/sysaux01.dbf4/oradata/ORCL/undotbs01.dbf5/oradata/ORCL/test.dbf7/oradata/ORCL/users01.dbf[oracle@test~]$ cd /oradata/ORCL/[oracle@test ORCL]$ ll
total 3986472-rw-r----- 1 oracle oinstall 618668032 Jul 25 02:47 sysaux01.dbf-rw-r----- 1 oracle oinstall 954212352 Jul 25 02:47 system01.dbf-rw-r----- 1 oracle oinstall 2147491840 Jul 25 02:47 test.dbf-rw-r----- 1 oracle oinstall 356524032 Jul 25 02:47 undotbs01.dbf-rw-r----- 1 oracle oinstall 5251072 Jul 25 02:47 users01.dbf
5 起库到open状态
alterdatabaseopen;select open_mode,database_role from v$database;