设置产生的归档日志保存位置

1.查数据库是否运行在archivelog中

sys@WISON>archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/oradata/wison/backup/arc
Oldest online log sequence     30
Next log sequence to archive   32
Current log sequence           32
sys@WISON>
or
sys@WISON>select log_mode from v$database;

LOG_MODE
------------
ARCHIVELOG

sys@WISON>

两种方式都可以查,但是第一种方式更加直接。

如何数据库运行在非归档模式下,我们首先要把数据库改成归档模式

  • shutdown 数据库 :shutdown immediate
  • 把数据库打开到mount状态:startup mount
  • 修改成归档模式:alter database archivelog
  • 打开数据库:alter database open
  • 最后对现在的数据库做一个全备份

步骤如下:

s1.查数据库运行在什么模式下

sys@WISON>archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u01/oradata/wison/backup/arc
Oldest online log sequence     30
Current log sequence           32
sys@WISON>
运行在:非归档模式下

s2:把数据库设置成归档模式

sys@WISON>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@WISON>startup mount
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area  640286720 bytes
Fixed Size                  1338420 bytes
Variable Size             457180108 bytes
Database Buffers          176160768 bytes
Redo Buffers                5607424 bytes
Database mounted.
sys@WISON>alter database archivelog;

Database altered.

sys@WISON>alter database open;

Database altered.

sys@WISON>

2.设置日志的归档位置
  • 设置归档位置:log_archive_dest_n=location=/backup/arc,log_archive_dest_n=enable
  • 设置自动归档:log_archive_start=true
  • 设置归档进程:log_archive_max_processes=4

每个参数的意义可以去看oracle 文档.

例子:

s1.查是否启动自动归档(当前联机日志满的时候就要归档)

sys@WISON>show parameter log_archive_start;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_start                    boolean     TRUE
sys@WISON>
启动了,如果没启动,请用以下语句启动

alter system set log_archive_start=true scope=both

s2:设置归档位置

alter system set log_archive_dest_n = 'location=/arc ' scope=both

alter system set log_archive_dest_state_n = 'enable' scope=both

s3:最后手动归档下当前联机日志,验证是不是设置成功

sys@WISON>alter system archive log current;

System altered.

sys@WISON>!
[oracle@oracle11gdemo ~]$ ls /u01/ora
oracle/       oradata/      oraInventory/ 
[oracle@oracle11gdemo ~]$ ls /u01/oradata/wison/backup/arc
1_31_764181356.arc  1_32_764181356.arc
[oracle@oracle11gdemo ~]$



你可能感兴趣的:(设置产生的归档日志保存位置)