db 转移

1.启动数据库,确定各种文件的位置情况:
[oracle@localhost ~]$ export ORACLE_SID=test
[oracle@localhost ~]$ sqlplus /nolog
SQL> conn / as sysdba
SQL> select name,open_mode,log_mode from v$database;
SQL> alter system switch logfile;
SQL> alter database backup controlfile to trace;
SQL> select file_name,status from dba_data_files;
SQL> select name from v$tempfile;
SQL> select group#,archived,status from v$log;
SQL> select member from v$logfile;
SQL> select name,archived,status from v$archived_log;
SQL> select name,status from v$controlfile;
SQL> show parameter dump;
SQL> create pfile from spfile;
SQL> shutdown immediate;
2.拷贝各种文件到目标位置:
拷贝数据文件到目标位置:
[oracle@localhost /]$ cp -R
拷贝归档日志文件到目标位置:
[oracle@localhost /]$ cp -R
拷贝控制文件到目标位置:
[oracle@localhost /]$ cp -R
拷贝redo文件到目标位置:
[oracle@localhost /]$ cp -R
3.在数据库中rename以上文件:
SQL> conn / as sysdba

SQL> startup mount;
SQL> alter database rename file '……/system01.dbf' to '……/system01.dbf'; (数据文件)
SQL> alter database rename file '……/temp01.dbf' to '……/temp01.dbf';(temp文件)
SQL> alter database rename file '…… /redo02.log' to '……/redo02.log';(redo文件)
SQL> shutdown immediate;
4.拷贝dump文件:
拷贝dump文件到目标位置:
[oracle@localhost /]$ cp -R /u01/app/oracle/admin/test /u03/test/dump
5.修改pfile文件内容:
需要修改的主要initSID.ora文件内容有:
*.control_files=' ……/ control01.ctl', '……/control02.ctl', '……/control03.ctl'
*.audit_file_dest='……/ adump'
*.background_dump_dest='……./bdump'
*.core_dump_dest='……/cdump'
*.user_dump_dest='……/udump'
*.db_recovery_file_dest='…../flash_recovery_area/' (10g中需要设置,决定archive log位置。其他版本的oracle DB修改LOG_ARCHIVE_DEST或LOG_ARCHIVE_DEST_n参数的值)
6.使用pfile启动数据库:
SQL> startup pfile='……/product/10.1.0/db_1/dbs/inittest.ora';
7.检查各种文件的转移情况:
SQL> select name,open_mode from v$database;
SQL> select file_name,status from dba_data_files;
SQL> select name from v$tempfile;
SQL> select group#,archived,status from v$log;
SQL> select member from v$logfile;
SQL> select name,archived,status from v$archived_log;
SQL> select name,status from v$controlfile;
SQL> show parameter dump;

你可能感兴趣的:(DB)