首页 > 代码库 > 设置数据库归档模式
设置数据库归档模式
查看数据库状态,数据库为归档模式
SYS@Riven hey~J->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 1
Current log sequence 1
注 归档路径为参数USE_DB_RECOVERY_FILE_DEST指定的路径,也就是快速恢复区路径
修改数据库为非归档模式(开启、关闭归档模式都需要在mount模式下进行)
SYS@Riven hey~J->shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@Riven hey~J->startup mount;
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2257800 bytes
Variable Size 541068408 bytes
Database Buffers 281018368 bytes
Redo Buffers 6586368 bytes
Database mounted.
SYS@Riven hey~J->alter database noarchivelog;
Database altered.
SYS@Riven hey~J->archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Current log sequence 1
SYS@Riven hey~J->select status from v$instance;
STATUS
------------
MOUNTED
SYS@Riven hey~J->alter database archivelog;
Database altered.
SYS@Riven hey~J->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 1
Current log sequence 1
SYS@Riven hey~J->alter database open;
Database altered.
数据库启动归档以后,特别要注意的是,归档文件所放的目录是否还有剩余空间,如果空间不足了,那么就会导致数据库hang的现象,因为当redo日志切换以后,日志将归档,日志是循环使用的,如果循环到未归档的redo文件以后,那么数据库就会出现hang的情况,等待日志的归档。所以,剩余空间和过期的归档日志都是必须要维护的。
设置数据库归档模式