1.11gR2中设置database至归档模式
[root@ora11g ~]# su - oracle
[oracle@ora11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 27 20:24:21 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount; (启动到mount状态)
ORACLE instance started.
Total System Global Area 417546240 bytes
Fixed Size 2213936 bytes
Variable Size 310380496 bytes
Database Buffers 96468992 bytes
Redo Buffers 8482816 bytes
Database mounted.
SQL> alter database archivelog; (切换至归档模式)
alter database archivelog
*
ERROR at line 1:
ORA-00265: instance recovery required, cannot set ARCHIVELOG mode
2.官方文档的解释
ORA-00265: instance recovery required, cannot set ARCHIVELOG mode
Cause: The database either crashed or was shutdown with the ABORT option. Media recovery cannot be enabled because the online logs may not be sufficient to recover the current datafiles.
Action: Open the database and then enter the SHUTDOWN command with the NORMAL or IMMEDIATE option.
究其原因是因为之前没有一致性关闭数据库,重新打开数据库,进行一致性关闭即可
3.解决:
SQL> alter database open;
Database altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 417546240 bytes
Fixed Size 2213936 bytes
Variable Size 310380496 bytes
Database Buffers 96468992 bytes
Redo Buffers 8482816 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter databse open;
alter databse open
4.修改归档日志路径(/u01/archive_log是准备存放归档的目录)
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 37
Next log sequence to archive 39
Current log sequence 39
SQL> show parameter recovery
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/flash_recovery_area (当前的归档目录)
db_recovery_file_dest_size big integer 3882M
recovery_parallelism integer 0
SQL> alter system set log_archive_dest_1='location=/u01/archive_log' scope=spfile;
System altered.
shutdown,startup,再次查看:
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/archive_log (己经改成目标目录了)
Oldest online log sequence 37
Next log sequence to archive 39
5.验证一下
先到新的归档目录下看一下:
[oracle@ora11g orcl]$ cd /u01/archive_log/
[oracle@ora11g archive_log]$ ll
total 0 (此时还没有归档文件)
手动加速一下:
SQL> alter system switch logfile; (多执行几次)
System altered.
再次查看一下:
[oracle@ora11g archive_log]$ ll
total 22196
-rw-r----- 1 oracle oinstall 22682624 Apr 27 21:11 1_39_843324852.dbf
-rw-r----- 1 oracle oinstall 1024 Apr 27 21:11 1_40_843324852.dbf
-rw-r----- 1 oracle oinstall 6144 Apr 27 21:11 1_41_843324852.dbf
-rw-r----- 1 oracle oinstall 1536 Apr 27 21:11 1_42_843324852.dbf
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29602308/viewspace-1150521/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29602308/viewspace-1150521/