Oracle归档开启和更改
运用 Xshell 客户端工具链接所在的 oracle 服务器
1.先进入数据库里面去
[root@DBSTANDBY ~]# su - oracle
[oracle@DBSTANDBY ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on 星期二 8月 28 09:30:05 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
2.查看oracle 归档的状态
SQL> archive log list;
数据库日志模式 非存档模式 //目前不是归档模式
自动存档 禁用
存档终点 USE_DB_RECOVERY_FILE_DEST
最早的联机日志序列 27711
当前日志序列 27713
3.xshell 新开一个终端 建立新的归档日志存放点。
[root@DBSTANDBY ~]# mkdir -p /u02/oracle/archive/
[root@DBSTANDBY ~]# chown -R oracle:oinstall /u02/*
4.修改归档日志位置
SQL> alter system set log_archive_dest_1='location=/u02/oracle/archive/';
System altered.
SQL> commit;
Commit complete.
5.关闭数据库
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
6.启动数据库至mount 状态下
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1586708480 bytes
Fixed Size 2253624 bytes
Variable Size 973081800 bytes
Database Buffers 603979776 bytes
Redo Buffers 7393280 bytes
Database mounted.
7.启用归档模式
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list; --查看是否生效
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u02/oracle/archive/
Oldest online log sequence 7
Next log sequence to archive 9
Current log sequence 9
SQL> alter system switch logfile; --更改生效
System altered.
SQL> commit; --提交
Commit complete.
SQL> quit