首页 > 其他分享 >RAC中多实例开启归档和闪回

RAC中多实例开启归档和闪回

时间:2023-04-27 09:46:45浏览次数:44  
标签:闪回 19.0 RAC database 0.0 SQL oracle mydb1 中多

下面是针对其中一个实例的步骤记录
注意事项:
0、参数修改只在一个节点执行即可,记得sid='*'
1、每个实例需切换环境变量
2、开归档需先关闭DB再mount来开启
3、闪回区开启需先设置大小再设置位置

以下操作只在节点1执行
1、设置环境变量、关闭DB之前先设置下归档路径
[oracle@mydb1 ~ ]\$ export ORACLE_SID=testdb1
[oracle@mydb1 ~ ]\$ env | grep ORA
ORACLE_SID=testdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1

[oracle@mydb1 ~ ]\$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Apr 21 15:38:36 2023
Version 19.18.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.18.0.0.0

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

SQL> set linesize 200
SQL> alter system set log_archive_dest_1='location=+ARCHDG' sid='*' scope=both;
System altered.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.18.0.0.0

2、关闭DB,在节点1开启归档,并启动所有节点DB
[oracle@mydb1 ~ ]\$ srvctl status database -d testdb
Instance testdb1 is running on node mydb1
Instance testdb2 is running on node mydb2
[oracle@mydb1 ~ ]\$
[oracle@mydb1 ~ ]\$ srvctl stop database -d testdb
[oracle@mydb1 ~ ]\$
[oracle@mydb1 ~ ]\$ srvctl status database -d testdb
Instance testdb1 is not running on node mydb1
Instance testdb2 is not running on node mydb2

[oracle@mydb1 ~ ]\$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Apr 21 15:40:32 2023
Version 19.18.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to an idle instance.

SQL> startup mount
ORACLE instance started.
Total System Global Area 6.0130E+10 bytes
Fixed Size 37254216 bytes
Variable Size 8187281408 bytes
Database Buffers 5.1808E+10 bytes
Redo Buffers 96960512 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.

SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> exit

[oracle@mydb1 ~ ]\$ srvctl start database -d testdb
[oracle@mydb1 ~ ]\$
[oracle@mydb1 ~ ]\$ srvctl status database -d testdb
Instance testdb1 is running on node mydb1
Instance testdb2 is running on node mydb2

3、开启闪回,根据实际情况设置闪回区大小,默认保留2天/1440分钟
[oracle@mydb1 ~ ]\$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Apr 21 15:42:19 2023
Version 19.18.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.18.0.0.0

SQL> set linesize 200
SQL> show parameter db_recovery_file;
NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
db_recovery_file_dest string
db_recovery_file_dest_size big integer 0
SQL> select flashback_on from v\$database;
FLASHBACK_ON
------------------------------------------------------
NO

SQL> alter system set db_recovery_file_dest_size=8g sid='*' scope=both;
System altered.

SQL> alter system set db_recovery_file_dest='+ARCHDG' sid='*' scope=both;
System altered.

SQL> alter database flashback on;
Database altered.

SQL> select flashback_on from v\$database;
FLASHBACK_ON
------------------------------------------------------
YES

SQL> show parameter db_recovery_file;
NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
db_recovery_file_dest string +ARCHDG
db_recovery_file_dest_size big integer 8G

SQL> show parameter db_flashback_retention_target
NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
db_flashback_retention_target integer 1440

SQL> alter system switch logfile;
System altered.
SQL>

标签:闪回,19.0,RAC,database,0.0,SQL,oracle,mydb1,中多
From: https://www.cnblogs.com/ritchy/p/17358036.html

相关文章

  • EBS: APP-PER-50022: ORACLE 人力资源管理系统无法检索用户类型配置文件选项的值
    在PO模块设置的人员,点击“人员”功能菜单时,提示: APP-PER-50022。。。。。的错误。路径:PO》》设置》》人员。APP-PER-50022:ORACLE人力资源管理系统无法检索用户类型配置文件选项的值。请确保为您的责任正确设置此值。尝试解决方式(失败了):  PROFILE |     ......
  • CellOracle | in silico gene perturbation | 新旧世代的交替
     目的:对我们的单细胞多组学数据作此分析,看那个de-diff的TF的敲除能够逆转分化方向。科研永远是追新者的天堂,不解释。 tutorial:Tutorial - ReadtheDocshttps://github.com/morris-lab/CellOracleDissectingcellidentityvianetworkinferenceandinsilicogenepe......
  • Oracle sql injection
    先创建一个普通用户并授权:C:\>sqlplus"/assysdba"SQL*Plus:Release10.2.0.1.0-Productionon星期三7月3121:49:452013Copyright(c)1982,2005,Oracle.Allrightsreserved.连接到:PersonalOracleDatabase10gRelease10.2.0.1.0-ProductionWiththe......
  • maven 增加oracle驱动
    进入ojdbc14.jar所在目录C:\oracle\product\10.2.0\db_1\jdbc\lib执行命令:mvninstall:install-file-DgroupId=com.oracle-DartifactId=ojdbc14-Dversion=10.2.0.1.0-Dpackaging=jar-Dfile=ojdbc14.jar输出:C:\oracle\product\10.2.0\db_1\jdbc\lib>mvninstall:i......
  • ORACLE修改列名与列类型
    --1.修改列名altertable表名renamecolumn旧列名to新列名;--实例altertablexsbrenamecolumnxhto学号;--2.修改列类型altertable表名modify(列名varchar(256));--实例altertablexsbmodify(学号varchar(256));--3.删除表的一列altertable表......
  • oracle plsql 自定义函数
    例如:CREATEORREPLACEFUNCTIONHELLO(strINVARCHAR2)RETURNVARCHAR2ISRETVARCHAR2(20);BEGINRET:='Hello'||str;DBMS_OUTPUT.put_line(RET);RETURNRET;END;执行:SELECTHELLO('yang')FROMDUAL;删除:DROPFUNCTIONHELLO;......
  • oracle pl sql 隐式游标SQL
    EMP表在SCOTT用户下。用SCOTT/TIGER登录。代码:BEGINUPDATEEMPSETENAME='SMITH'WHEREEMPNO=7369;DBMS_OUTPUT.put_line('SQL%ROWCOUNT='||SQL%ROWCOUNT);IFSQL%ISOPENTHENDBMS_OUTPUT.put_line('SQL%ISOPEN');ELSEDBM......
  • oracle exp/imp 导入导出数据
    exphibernate/hibernate@orclfile=c:\emp.dmptables=(hibernate.emp)imphibernate/hibernate@orclfile=c:\emp.dmpimp前,先要删除表,否则导入会失败。语法:EXP有三种主要的方式(完全、用户、表) 完全EXPSYSTEM/MANAGERBUFFER=64000FILE=C:\FULL.DMPFULL=Y 如果要执行完全......
  • oracle 分析函数 RANK、DENSE_RANK、ROW_NUMBER
    Row_number函数返回一个唯一的值,当碰到相同数据时,排名按照记录集中记录的顺序依次递增。 Dense_rank函数返回一个唯一的值,除非当碰到相同数据时,此时所有相同数据的排名都是一样的。 Rank函数返回一个唯一的值,除非遇到相同的数据时,此时所有相同数据的排名是一样的,同时会在最后一条......
  • oracle 高级分组 GROUPING SETS
    用SCOTT/TIGER登录。groupingsets就是对参数中的每个参数做group,也就是有几个参数做几次group。SQL:SELECTJOB,DEPTNO,SUM(SAL)FROMEMPGROUPBYGROUPINGSETS(JOB,DEPTNO);结果:......