日期:2014-05-16 浏览次数:20507 次
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/11408889
正确答案:B
做热备的前提条件是一定要开归档,可以用以下几种方式查一下有没有开归档:
方法一:
sys@OCM> archive log list; Database log mode No Archive Mode Automatic archival Disabled Archive destination /arch Oldest online log sequence 2 Next log sequence to archive 4 Current log sequence 4
方法二:查视图
sys@OCM> select log_mode from v$database; LOG_MODE ------------ NOARCHIVELOG
方法三:转出CONTROLFILE的创建脚本:
sys@OCM> alter database backup controlfile to trace as '/tmp/control.txt'; Database altered. CREATE CONTROLFILE REUSE DATABASE "OCM" NORESETLOGS NOARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 '/u01/app/oracle/oradata/ocm/redo01.log' SIZE 50M BLOCKSIZE 512, GROUP 2 '/u01/app/oracle/oradata/ocm/redo02.log' SIZE 50M BLOCKSIZE 512, GROUP 3 '/u01/app/oracle/oradata/ocm/redo03.log' SIZE 50M BLOCKSIZE 512 -- STANDBY LOGFILE DATAFILE '/u01/app/oracle/oradata/ocm/system01.dbf', '/u01/app/oracle/oradata/ocm/sysaux01.dbf', '/u01/app/oracle/oradata/ocm/undotbs01.dbf', '/u01/app/oracle/oradata/ocm/users01.dbf', '/u01/app/oracle/oradata/ocm/example01.dbf', '/u01/app/oracle/oradata/ocm/gyj01.dbf', '/u01/app/oracle/oradata/ocm/gyj02.dbf', '/u01/app/oracle/oradata/ocm/tp01.dbf' CHARACTER SET ZHS16GBK ;
提供用户管理热备的脚本:
sys@OCM> SELECT 'alter tablespace '||tablespace_name||' begin backup;'||chr(10)|| 2 '!cp '||file_name||' /backup/hot'||chr(10)|| 3 'alter tablespace '||tablespace_name||' end backup;' 4 FROM dba_data_files; 'ALTERTABLESPACE'||TABLESPACE_NAME||'BEGINBACKUP;'||CHR(10)||'!CP'||FILE_NAME||'/BACKUP/HOT'||CHR(10)||'ALTERTABLESPACE'||TABLESPACE_NAME||'ENDBACKUP;' --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- alter tablespace TP1 begin backup; !cp /u01/app/oracle/oradata/ocm/tp01.dbf /backup/hot alter tablespace TP1 end backup; alter tablespace GYJ begin backup; !cp /u01/app/oracle/oradata/ocm/gyj02.dbf /backup/hot alter tablespace GYJ end backup; alter tablespace GYJ begin backup; !cp /u01/app/oracle/oradata/ocm/gyj01.dbf /backup/hot alter tablespace GYJ end backup; alter tablespace EXAMPLE begin backup; !cp /u01/app/oracle/oradata/ocm/example01.dbf /backup/hot alter tablespace EXAMPLE end backup; alter tablespace USERS begin backup; !cp /u01/app/oracle/oradata/ocm/users01.dbf /backup/hot alter tablespace USERS end backup; alter tablespace UNDOTBS1 begin backup; !cp /u01/app/oracle/oradata/ocm/undotbs01.dbf /backup/hot alter tablespace UNDOTBS1 end backup; alter tablespace SYSAUX begin backup; !cp /u01/app/oracle/oradata/ocm/sysaux01.dbf /backup/hot alter tablespace SYSAUX end backup; alter tablespace SYSTEM begin backup; !cp /u01/app/oracle/oradata/ocm/system01.dbf /backup/hot alter tablespace SYSTEM end backup;
对于用户管理下热备的底层原理在以后的题目中到再来解析。。。
QQ:252803295
技术交流QQ群:
DSI&Core Search Ⅰ 群:127149411(2000人技术群:未满)
DSI&Core Search Ⅱ 群:177089463(1000人技术群:未满)
DSI&Core Search Ⅲ 群:284596437(500人技术群:未满)
DSI&Core Search Ⅳ 群:1921367