Oracle19c 归档模式开启与关闭(Linux)

Oracle19c 归档模式开启与关闭

oracle19c的归档模式必须在容器数据库(cdb)一级开启,开启后,全部pdb启用归档模式;

1、开启归档流程

以SYS用户连接Oracle 12c 数据库
sqlplus / as sysdba
关闭数据库。
shutdown immediate;
加载数据库到MOUNT状态。
startup mount;
查看归档模式
archive log list;
查看pdb列表
show pdbs;
切换到pdb
alter session set container=pdb1;
查看pdb归档模式
archive log list;
切换到容器数据库
alter session set container=cdb$root;
开启日志归档模式
alter database archivelog;
查看归档模式
archive log list;
打开数据库
alter database open;
切换到pdb
alter session set container=pdb1;
查看归档模式
archive log list;
打开pdb数据库
alter pluggable database pdb1 open;

2、开启归档模式

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Jul 3 09:32:05 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 1027600648 bytes
Fixed Size                  9142536 bytes
Variable Size             264241152 bytes
Database Buffers          746586112 bytes
Redo Buffers                7630848 bytes
Database mounted.
SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u01/app/oracle/product/19.3.0/dbhome_1/dbs/arch
Oldest online log sequence     9
Current log sequence           11
SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       MOUNTED
         3 PDB1                           MOUNTED
SQL> alter session set container=pdb1;

Session altered.

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u01/app/oracle/product/19.3.0/dbhome_1/dbs/arch
Oldest online log sequence     9
Current log sequence           11
SQL> alter session set container=cdb$root;

Session altered.

SQL> alter database archivelog;

Database altered.

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/product/19.3.0/dbhome_1/dbs/arch
Oldest online log sequence     9
Next log sequence to archive   11
Current log sequence           11
SQL> alter database open;

Database altered.

SQL> alter session set container=pdb1;

Session altered.

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/product/19.3.0/dbhome_1/dbs/arch
Oldest online log sequence     9
Next log sequence to archive   11
Current log sequence           11
SQL> alter pluggable database pdb1 open;

Pluggable database altered.

SQL>

3、关闭归档模式

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Jul 3 08:38:02 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1027600648 bytes
Fixed Size                  9142536 bytes
Variable Size             264241152 bytes
Database Buffers          746586112 bytes
Redo Buffers                7630848 bytes
Database mounted.
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/product/19.3.0/dbhome_1/dbs/arch
Oldest online log sequence     9
Next log sequence to archive   11
Current log sequence           11
SQL> alter database noarchivelog;

Database altered.

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u01/app/oracle/product/19.3.0/dbhome_1/dbs/arch
Oldest online log sequence     9
Current log sequence           11
SQL> alter database open;

Database altered.

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           MOUNTED
SQL> alter pluggable database pdb1 open;

Pluggable database altered.

SQL> alter session set container = pdb1;

Session altered.

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u01/app/oracle/product/19.3.0/dbhome_1/dbs/arch
Oldest online log sequence     9
Current log sequence           11
SQL>

你可能感兴趣的:(oracle,oracle19c,归档模式,pdb,cdb)