十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
小编给大家分享一下Oracle+ASM单机环境下如何开启归档,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
创新互联是一家专业提供延寿企业网站建设,专注与网站建设、网站制作、H5页面制作、小程序制作等业务。10年已为延寿众多企业、政府机构等服务。创新互联专业网络公司优惠进行中。
在ASM单机环境下,开启归档的最简单的方法。
环境:oracle11g 11.2.0.4
登陆sqlplus
[oracle@udevasm ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 8 18:20:41 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
要把Oracle数据库给启动到Open状态
SQL> startup
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 331350920 bytes
Database Buffers 729808896 bytes
Redo Buffers 5517312 bytes
Database mounted.
Database opened.
查看ASM空间使用率
SQL> select group_number,name,total_mb,free_mb from v$asm_diskgroup;
GROUP_NUMBER NAME TOTAL_MB FREE_MB
------------ ------------------------------ ---------- ----------
1 DGDATA01 22520 260
2 DGDATA02 20472 14132
3 DGRECOVERY 21500 21420
4 DGSYSTEM 20472 20392
5 GRID1 10232 10144
查看归档状态
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /oracle/app/oracle/product/11.2.0/dbs/arch
Oldest online log sequence 9
Current log sequence 14
SQL> show user
USER is "SYS"
关库,或使用命令:shutdown immediate来关闭
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
启库到mount
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 331350920 bytes
Database Buffers 729808896 bytes
Redo Buffers 5517312 bytes
Database mounted.
查看当前节点的状态
SQL> select status from gv$instance;
STATUS
------------
MOUNTED
为节点开启归档,开启归档
SQL> alter database archivelog;
Database altered.
查看归档状态,发现归档日志路径不对,并不是默认的路径在ASM中的路径
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/app/oracle/product/11.2.0/dbs/arch
Oldest online log sequence 9
Next log sequence to archive 14
Current log sequence 14
修改归档路径
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=+DGRECOVERY/' SCOPE=SPFILE SID='udevasm';
查看当前修改后路径
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +DGRECOVERY/arc
Oldest online log sequence 9
Next log sequence to archive 14
Current log sequence 14
节点启库
SQL> alter database open;
Database altered.
SQL> select status from v$instance;
STATUS
------------
OPEN
来看一下,归档路径的信息,默认是直接指向了ASM中的路径
SQL> show parameter log_archive_dest;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest string
log_archive_dest_1 string LOCATION=+DGRECOVERY/ARC
log_archive_dest_10 string
log_archive_dest_11 string
log_archive_dest_12 string
log_archive_dest_13 string
log_archive_dest_14 string
log_archive_dest_15 string
log_archive_dest_16 string
log_archive_dest_17 string
log_archive_dest_18 string
到ASM下看一下归档文件
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 4194304 22520 260 0 260 0 N DGDATA01/
MOUNTED EXTERN N 512 4096 4194304 20472 14132 0 14132 0 N DGDATA02/
MOUNTED EXTERN N 512 4096 4194304 21500 21420 0 21420 0 N DGRECOVERY/
MOUNTED EXTERN N 512 4096 4194304 20472 20392 0 20392 0 N DGSYSTEM/
MOUNTED EXTERN N 512 4096 4194304 10232 10144 0 10144 0 N GRID1/
SMCMD> cd 2017_06_08/
ASMCMD> l
thread_1_seq_14.256.946154499
thread_1_seq_15.257.946154499
thread_1_seq_16.258.946154499
thread_1_seq_17.259.946154499
thread_1_seq_18.260.946154501
thread_1_seq_19.261.946154523
thread_1_seq_20.262.946154571
看完了这篇文章,相信你对“Oracle+ASM单机环境下如何开启归档”有了一定的了解,如果想了解更多相关知识,欢迎关注创新互联行业资讯频道,感谢各位的阅读!