首頁  >  文章  >  資料庫  >  Oracle 10备份与恢复之归档模式配置

Oracle 10备份与恢复之归档模式配置

WBOY
WBOY原創
2016-06-07 16:58:40852瀏覽

文章的前面回把开启归档模式及设置归档日志格式等内容放到前面,便于查阅及理清思路。后面会对每一部都进行详细的描述 SQLgt; a

文章的前面回把开启归档模式及设置归档日志格式等内容放到前面,便于查阅及理清思路。后面会对每一部都进行详细的描述

 

SQL> archive log list  //查看当前归档模式
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     3
Current log sequence           5
开启归档模式

SQL> shutdown immediate
Database closed.
Database dismounted.
Oracle instance shut down.

SQL> startup mount;
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                  2022832 bytes
Variable Size             222298704 bytes
Database Buffers          385875968 bytes
Redo Buffers                2170880 bytes
Database mounted.

 

SQL> alter database archivelog;  //开启归档模式

Database altered.

 

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     3
Next log sequence to archive   5
Current log sequence           5

 

修改归档日志存放地

SQL> alter system set db_recovery_file_dest=‘’;

System altered.

 

SQL> alter system set log_archive_dest=‘/home/oracle/backup’;

System altered.

 

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /home/oracle/backup
Oldest online log sequence     3
Next log sequence to archive   5
Current log sequence           5
注:

从oracle10g开始默认情况下,归档日志会存放到快速恢复区所对应的目录(对应于初始化参数db_recovery_file_dest)并且会按照特定的格式生成归档日志文件名,如果我们不修改db_recovery_file_dest=‘'为空,,而直接指定log_archive_dest的路径则会报错。如下:

SQL> alter system set log_archive_dest='/home/oracle/backup';
alter system set log_archive_dest='/home/oracle/backup'
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-16018: cannot use LOG_ARCHIVE_DEST with LOG_ARCHIVE_DEST_n or
DB_RECOVERY_FILE_DEST

 

SQL> alter system set log_archive_format=’ARC%S_%R.%T.arc‘ scope=spfile;

System altered.

SQL> alter system switch logfile;  //日志格式的修改仍然没有生效,尝试重启数据库使之生效,生成.arc结尾的文件

System altered.

SQL> alter database open;

Database altered.

SQL> alter system switch logfile;  //手工切换,目的是产生归档日志,在backup目录下查看生成的文件

System altered.

cd /home/oracle/backup
$ ls
1_5_736446919.dbf                  1_6_736446919.dbf                  1_7_736446919.dbf                  ARC0000000008_0736446919.0001.arc

linux

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn