2016年6月14日 星期二

[Oracle] 安裝Oracle RAC 11g R2 Cluster on RedHat Linux 6.5 (九) Enabled Archivelog (啟用歸檔模式)

在Oracle RAC 11g R2 Cluster啟用Archivelog(歸檔)有兩種方式,
一 不指定log_archive_dest_1,若不指定預設路徑會在FRA的路徑下
二 指定log_archive_dest_1(建議用這種)

方式一 不指定log_archive_dest_1
1. 在NODE01連線到資料庫
sqlplus / as sysdba
2. 查看是否啟用Archivelog
archive log list;
3. 回到作業系統,關閉資料庫
srvctl stop database -d orcl
4. 將資料庫啟動在mount
srvctl start database -d orcl -o mount
5. 連線到資料庫
sqlplus / as sysdba
6. 啟用Archivelog
ALTER DATABASE ARCHIVELOG;
7. 查看是否啟用Archivelog
archive log list;

完整執行程序如下
[oracle@racnode01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 14 14:01:39 2016
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, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> archive log list;
Database log mode        No Archive Mode
Automatic archival        Disabled
Archive destination        USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     11
Current log sequence        12
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@racnode01 ~]$ srvctl stop database -d orcl
[oracle@racnode01 ~]$ srvctl start database -d orcl -o mount
[oracle@racnode01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 14 14:03:42 2016
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, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> ALTER DATABASE ARCHIVELOG;
Database altered.
SQL> exit;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@racnode01 ~]$ srvctl stop database -d orcl
[oracle@racnode01 ~]$ srvctl start database -d orcl
[oracle@racnode01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 14 14:05:08 2016
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, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> archive log list;
Database log mode        Archive Mode
Automatic archival        Enabled
Archive destination        USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     11
Next log sequence to archive   12
Current log sequence        12


方法二  指定log_archive_dest_1
1. 在NODE01連線到資料庫
sqlplus / as sysdba
2. 查看是否啟用Archivelog
archive log list;
3. 指定archivelog路徑,本範例為指定到ASM的DATA02
ALTER SYSTEM SET log_archive_dest_1='location=+DATA02' SCOPE=spfile;
4. 指定archivelog檔案格式
ALTER SYSTEM SET log_archive_format='arch_%t_%s_%r.arc' SCOPE=spfile;
5. 回到作業系統,關閉資料庫
srvctl stop database -d orcl
6. 將資料庫啟動在mount
srvctl start database -d orcl -o mount
7. 連線到資料庫
sqlplus / as sysdba
8. 啟用Archivelog
ALTER DATABASE ARCHIVELOG;
9. 查看是否啟用Archivelog
archive log list;

完整執行程序如下
[oracle@racnode01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 15 10:43:52 2016
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, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> archive log list;
Database log mode        No Archive Mode
Automatic archival        Disabled
Archive destination        USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     11
Current log sequence        12
SQL> ALTER SYSTEM SET log_archive_dest_1='location=+DATA02' SCOPE=spfile;
System altered.
SQL> ALTER SYSTEM SET log_archive_format='arch_%t_%s_%r.arc' SCOPE=spfile;
System altered.
SQL> exit;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@racnode01 ~]$ srvctl stop database -d orcl
[oracle@racnode01 ~]$ srvctl start database -d orcl -o mount
[oracle@racnode01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 15 10:55:05 2016
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, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> ALTER DATABASE ARCHIVELOG;
Database altered.
SQL> exit;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@racnode01 ~]$ srvctl stop database -d orcl
[oracle@racnode01 ~]$ srvctl start database -d orcl
[oracle@racnode01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 15 10:56:30 2016
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, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> archive log list;
Database log mode        Archive Mode
Automatic archival        Enabled
Archive destination        +DATA02
Oldest online log sequence     11
Next log sequence to archive   12
Current log sequence        12






沒有留言:

張貼留言