archive

开启归档

  1. 核心SQL
    idle>shutdown immediate
    idle>startup mount (数据库)
    idle>alter database archivelog; (mount状态下才能归档)
    idle>alter database open;
    idle>desc v$database
    idle>select log_mode from v$database; (查看现在是不是归档模式方法一)
    idle>archive log list(查看现在是不是归档模式方法二)

  2. ERROR ORA-00265
    在这里插入图片描述
    原因:之前关闭数据库时没有用shutdown immediate,导致数据库没有正常关闭(shutdown abort)
    解决办法: alter database open>shutdown immediate>接着上面步骤进行即可

关闭归档

  1. 核心SQL
    idle>shutdown immediate
    idle>startup mount (数据库)
    idle>alter database noarchivelog;
    idle>alter database open;
    idle>desc v$database
    idle>select log_mode from v$database; (查看现在是不是归档模式方法一)
    idle>archiev log list(查看现在是不是归档模式方法二)

  2. 实验详细

Using username "root".
Authenticating with public key "rsa-key-20190527"
Last login: Sun Jun 16 11:04:39 2019 from 192.168.1.106
[root@db01 ~]#
[root@db01 ~]#
[root@db01 ~]# su - oracle
Last login: Sun Jun 16 11:03:57 CST 2019 on pts/0
[oracle@db01 ~]$
[oracle@db01 ~]$
[oracle@db01 ~]$ sqls

SQL*Plus: Release 11.2.0.1.0 Production on Sun Jun 16 11:08:07 2019

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

idle>
idle>
idle>
idle>alter database open;

Database altered.

idle>
idle>
idle>
idle>shutdown immediate  //这里保证数据库是immediate关闭,如果是abort,相当于数据库不正常关闭,接下来就会报错
Database closed.
Database dismounted.
ORACLE instance shut down.     
idle>
idle>
idle>
idle>
idle>
idle>
idle>
idle>
idle>startup mount




ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2213856 bytes
Variable Size             314574880 bytes
Database Buffers           88080384 bytes
Redo Buffers                4325376 bytes
Database mounted.
idle>
idle>
idle>alter database noarchivelog;

Database altered.

idle>
idle>
idle>alter database open;

Database altered.

idle>
idle>
idle>
idle>desc v$database
 Name                                                                             Null?    Type
 ----------------------------------------------------------------------------------------------------------------- -------- ----------------------------------------------------------------------------
 DBID                                                                              NUMBER
 NAME                                                                              VARCHAR2(9)
 CREATED                                                                           DATE
 RESETLOGS_CHANGE#                                                                 NUMBER
 RESETLOGS_TIME                                                                    DATE
 PRIOR_RESETLOGS_CHANGE#                                                           NUMBER
 PRIOR_RESETLOGS_TIME                                                              DATE
 LOG_MODE                                                                          VARCHAR2(12)
 CHECKPOINT_CHANGE#                                                                NUMBER
 ARCHIVE_CHANGE#                                                                   NUMBER
 CONTROLFILE_TYPE                                                                  VARCHAR2(7)
 CONTROLFILE_CREATED                                                               DATE
 CONTROLFILE_SEQUENCE#                                                             NUMBER
 CONTROLFILE_CHANGE#                                                               NUMBER
 CONTROLFILE_TIME                                                                  DATE
 OPEN_RESETLOGS                                                                    VARCHAR2(11)
 VERSION_TIME                                                                      DATE
 OPEN_MODE                                                                         VARCHAR2(20)
 PROTECTION_MODE                                                                   VARCHAR2(20)
 PROTECTION_LEVEL                                                                  VARCHAR2(20)
 REMOTE_ARCHIVE                                                                    VARCHAR2(8)
 ACTIVATION#                                                                       NUMBER
 SWITCHOVER#                                                                       NUMBER
 DATABASE_ROLE                                                                     VARCHAR2(16)
 ARCHIVELOG_CHANGE#                                                                NUMBER
 ARCHIVELOG_COMPRESSION                                                            VARCHAR2(8)
 SWITCHOVER_STATUS                                                                 VARCHAR2(20)
 DATAGUARD_BROKER                                                                  VARCHAR2(8)
 GUARD_STATUS                                                                      VARCHAR2(7)
 SUPPLEMENTAL_LOG_DATA_MIN                                                         VARCHAR2(8)
 SUPPLEMENTAL_LOG_DATA_PK                                                          VARCHAR2(3)
 SUPPLEMENTAL_LOG_DATA_UI                                                          VARCHAR2(3)
 FORCE_LOGGING                                                                     VARCHAR2(3)
 PLATFORM_ID                                                                       NUMBER
 PLATFORM_NAME                                                                     VARCHAR2(101)
 RECOVERY_TARGET_INCARNATION#                                                      NUMBER
 LAST_OPEN_INCARNATION#                                                            NUMBER
 CURRENT_SCN                                                                       NUMBER
 FLASHBACK_ON                                                                      VARCHAR2(18)
 SUPPLEMENTAL_LOG_DATA_FK                                                          VARCHAR2(3)
 SUPPLEMENTAL_LOG_DATA_ALL                                                         VARCHAR2(3)
 DB_UNIQUE_NAME                                                                    VARCHAR2(30)
 STANDBY_BECAME_PRIMARY_SCN                                                        NUMBER
 FS_FAILOVER_STATUS                                                                VARCHAR2(22)
 FS_FAILOVER_CURRENT_TARGET                                                        VARCHAR2(30)
 FS_FAILOVER_THRESHOLD                                                             NUMBER
 FS_FAILOVER_OBSERVER_PRESENT                                                      VARCHAR2(7)
 FS_FAILOVER_OBSERVER_HOST                                                         VARCHAR2(512)
 CONTROLFILE_CONVERTED                                                             VARCHAR2(3)
 PRIMARY_DB_UNIQUE_NAME                                                            VARCHAR2(30)
 SUPPLEMENTAL_LOG_DATA_PL                                                          VARCHAR2(3)
 MIN_REQUIRED_CAPTURE_CHANGE#                                                      NUMBER

idle>
idle>select log_mode from v$database;

LOG_MODE
------------
NOARCHIVELOG

idle>
idle>
idle>
idle>archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     23
Current log sequence           25
idle>
idle>
idle>
idle>

补充
Shutdown 三种状态: normal ,immediate,abort

你可能感兴趣的:(oracle,#,oracle_note)