标签:
SQL> select name from v$datafile;NAME
--------------------------------------------------------------------------------
/u02/oradata/db01/system01.dbf
/u02/oradata/db01/undotbs01.dbf
/u02/oradata/db01/sysaux01.dbf
/u02/oradata/db01/users01.dbfSQL> select name from v$controlfile;NAME
--------------------------------------------------------------------------------
/u02/oradata/db01/control01.ctl
/u02/oradata/db01/control02.ctl
/u02/oradata/db01/control03.ctl
/u01/app/oracle/bak/control04.ctl<2>以DBA用户或特权用户关闭数据库。SQL> conn / as sysdba;
Connected.
SQL> shutdown normal
Database closed.
Database dismounted.
ORACLE instance shut down.<3>复制数据文件,复制时应该将文件复制到单独的一个硬盘或者磁盘上。控制文件是相互镜像的,因此只需复制一个控制文件即可。cp /u02/oradata/db01/*.dbf /u01/app/oracle/bakcp /u02/oradata/db01/*.ctl /u01/app/oracle/bak<4>启动例程打开数据库。SQL> conn / as sysdba;
Connected to an idle instance.
SQL> startup
ORACLE instance started.Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 83887696 bytes
Database Buffers 197132288 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL>
<6>确定数据库处于归档模式下,并且设置自动存档:SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2上面的Archive destination所定义的具体位置,可以查看$ORACLE_HOME/dbs/spfile<dbname>.ora文件中的db_recovery_file_dest参数的值。
SQL> select file_name from dba_data_files where tablespace_name=‘USERS‘;FILE_NAME
--------------------------------------------------------------------------------
/u02/oradata/db01/users01.dbf<2>设置表空间为备份模式,在复制表空间的数据文件之前必须将表空间设置成为备份模式:SQL> alter tablespace users begin backup;Tablespace altered.<3>复制users数据文件到备份目录:[oracle@server1 bak]$ cp /u02/oradata/db01/users01.dbf /bak<4>复制后表空间就不需要设置成为备份模式了,因此可以将其返回正常模式:SQL> alter tablespace users end backup;Tablespace altered.
SQL> select file_name from dba_data_files where tablespace_name=‘USERS‘;FILE_NAME
--------------------------------------------------------------------------------
/u02/oradata/db01/users01.dbf<2>设置表空间为脱机状态,将表空间设置为脱机状态后用户将不能访问该表空间上的任何对象,因此也可以确保OFFLINE的表空间的数据文件不会发生改变。SQL> alter tablespace users offline;Tablespace altered.SQL> select tablespace_name,online_status from dba_data_files;TABLESPACE_NAME ONLINE_
------------------------------ -------
USERS OFFLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
SYSTEM SYSTEM<3>复制users数据文件到备份目录:[oracle@server1 bak]$ cp /u02/oradata/db01/users01.dbf /bak<4>复制完后将表空间置于online状态:SQL> alter tablespace users online;Tablespace altered.SQL> select tablespace_name,online_status from dba_data_files;TABLESPACE_NAME ONLINE_
------------------------------ -------
USERS ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
SYSTEM SYSTE
标签:
原文地址:http://www.cnblogs.com/zhengcheng/p/4202677.html