[root@rac1 ~]# su - grid
[grid@rac1 ~]$ cd /g01/app/11.2.0/grid/network/admin/
[grid@rac1 admin]$ cat listener.ora
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME= PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME=orcl1)
)
)
[grid@rac1 admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-DEC-2023 19:47:50
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 19-DEC-2023 09:17:06
Uptime 0 days 10 hr. 30 min. 43 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /g01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /g01/app/grid/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.30)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.32)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl1", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
RAC2节点切换到Grid用户,增加静态监听,确认监听生效。
[root@rac2 ~]# su - grid
[grid@rac2 ~]$ cd /g01/app/11.2.0/grid/network/admin/
[grid@rac2 admin]$ cat listener.ora
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME= PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME=orcl2)
)
)
[grid@rac2 admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-DEC-2023 19:47:32
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 19-DEC-2023 09:17:16
Uptime 0 days 10 hr. 30 min. 16 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /g01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /g01/app/grid/diag/tnslsnr/rac2/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.31)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.33)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl2", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[grid@rac2 admin]$
2.3、RAC备库增加参数
alter system set db_file_name_convert='+DATA','+DATA' scope=spfile;
alter system set log_file_name_convert='+DATA','+DATA' scope=spfile;
alter system set fal_client='orcl' scope=spfile;
alter system set fal_server='primary' scope=spfile;
alter system set log_archive_config='DG_CONFIG=(primary,orcl)' scope=spfile;
alter system set log_archive_dest_1='location=+DATA valid_for=(all_logfiles,all_roles) db_unique_name=orcl' scope=spfile;
alter system set log_archive_dest_2='service=primary ASYNC NOAFFIRM valid_for=(online_logfiles,primary_role) db_unique_name=primary' scope=spfile;
alter system set log_archive_format='%t_%s_%r.dbf' scope=spfile;
alter system set standby_file_management='AUTO' scope=spfile;
[grid@rac2 ~]$ asmcmd
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 12288 6668 0 6668 0 N DATA/
MOUNTED NORMAL N 512 4096 1048576 9216 8290 3072 2609 0 Y VOTE/
ASMCMD> cd data/orcl
ASMCMD> rm -rf CONTROLFILE
ASMCMD> rm -rf DATAFILE
ASMCMD> rm -rf ONLINELOG
ASMCMD> mkdir CONTROLFILE
ASMCMD> mkdir DATAFILE
ASMCMD> mkdir ONLINELOG
启动数据库单实例
sqlplus / as sysdba
startup nomount;
2.7、在备库RAC1节点执行duplicate 复制
rman target sys/oracle@primary auxiliary sys/oracle@racdg
DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE NOFILENAMECHECK;
以下为输出
[oracle@rac1 admin]$ rman target sys/oracle@primary auxiliary sys/oracle@racdg
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Dec 19 20:44:54 2023
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1613952925)
connected to auxiliary database: ORCL (not mounted)
RMAN> DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE NOFILENAMECHECK;
Starting Duplicate Db at 19-DEC-23
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=194 instance=orcl1 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapworcl2' auxiliary format
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapworcl1' ;
}
executing Memory Script
Starting backup at 19-DEC-23
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=205 instance=orcl2 device type=DISK
Finished backup at 19-DEC-23
contents of Memory Script:
{
sql clone "alter system set control_files =
''+DATA/orcl/controlfile/current.352.1156020305'', ''+DATA/orcl/controlfile/current.351.1156020305'' comment=
''Set by RMAN'' scope=spfile";
backup as copy current controlfile for standby auxiliary format '+DATA/orcl/controlfile/current.350.1156020305';
restore clone controlfile to '+DATA/orcl/controlfile/current.349.1156020305' from
'+DATA/orcl/controlfile/current.350.1156020305';
sql clone "alter system set control_files =
''+DATA/orcl/controlfile/current.350.1156020305'', ''+DATA/orcl/controlfile/current.349.1156020305'' comment=
''Set by RMAN'' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set control_files = ''+DATA/orcl/controlfile/current.352.1156020305'', ''+DATA/orcl/controlfile/current.351.1156020305'' comment= ''Set by RMAN'' scope=spfile
Starting backup at 19-DEC-23
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=+DATA/orcl/controlfile/snap_control.f tag=TAG20231219T204506 RECID=30 STAMP=1156020311
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 19-DEC-23
Starting restore at 19-DEC-23
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 19-DEC-23
sql statement: alter system set control_files = ''+DATA/orcl/controlfile/current.350.1156020305'', ''+DATA/orcl/controlfile/current.349.1156020305'' comment= ''Set by RMAN'' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 801701888 bytes
Fixed Size 2257520 bytes
Variable Size 339742096 bytes
Database Buffers 452984832 bytes
Redo Buffers 6717440 bytes
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.
contents of Memory Script:
{
set newname for tempfile 1 to
"+data";
switch clone tempfile all;
set newname for datafile 1 to
"+data";
set newname for datafile 2 to
"+data";
set newname for datafile 3 to
"+data";
set newname for datafile 4 to
"+data";
set newname for datafile 5 to
"+data";
set newname for datafile 6 to
"+data";
set newname for datafile 7 to
"+data";
set newname for datafile 8 to
"+data";
set newname for datafile 9 to
"+data";
set newname for datafile 10 to
"+data";
set newname for datafile 11 to
"+data";
set newname for datafile 12 to
"+data";
set newname for datafile 13 to
"+data";
backup as copy reuse
datafile 1 auxiliary format
"+data" datafile
2 auxiliary format
"+data" datafile
3 auxiliary format
"+data" datafile
4 auxiliary format
"+data" datafile
5 auxiliary format
"+data" datafile
6 auxiliary format
"+data" datafile
7 auxiliary format
"+data" datafile
8 auxiliary format
"+data" datafile
9 auxiliary format
"+data" datafile
10 auxiliary format
"+data" datafile
11 auxiliary format
"+data" datafile
12 auxiliary format
"+data" datafile
13 auxiliary format
"+data" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to +data in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 19-DEC-23
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/orcl/datafile/system.256.1086172033
output file name=+DATA/orcl/datafile/system.348.1156020355 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/orcl/datafile/sysaux.257.1086172033
output file name=+DATA/orcl/datafile/sysaux.347.1156020401 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA/orcl/datafile/undotbs2.267.1086172237
output file name=+DATA/orcl/datafile/undotbs2.346.1156020437 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=+DATA/orcl/datafile/prod.273.1086172629
output file name=+DATA/orcl/datafile/prod.345.1156020443 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00007 name=+DATA/primary/datafile/users.297.1147790221
output file name=+DATA/orcl/datafile/users.344.1156020451 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA/orcl/datafile/undotbs1.258.1086172033
output file name=+DATA/orcl/datafile/undotbs1.343.1156020455 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00008 name=+DATA/primary/datafile/users.331.1147792495
output file name=+DATA/orcl/datafile/users.342.1156020457 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00009 name=+DATA/primary/datafile/users.335.1147792667
output file name=+DATA/orcl/datafile/users.341.1156020459 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00010 name=+DATA/primary/datafile/users.338.1147793229
output file name=+DATA/orcl/datafile/users.340.1156020461 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00011 name=+DATA/primary/datafile/users.339.1147793259
output file name=+DATA/orcl/datafile/users.378.1156020461 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/orcl/datafile/users.259.1086172033
output file name=+DATA/orcl/datafile/users.377.1156020463 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00012 name=+DATA/primary/datafile/users.353.1147806089
output file name=+DATA/orcl/datafile/users.376.1156020463 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00013 name=+DATA/primary/datafile/users.378.1147818285
output file name=+DATA/orcl/datafile/users.375.1156020465 tag=TAG20231219T204554
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:02
Finished backup at 19-DEC-23
sql statement: alter system archive log current
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=30 STAMP=1156020467 file name=+DATA/orcl/datafile/system.348.1156020355
datafile 2 switched to datafile copy
input datafile copy RECID=31 STAMP=1156020467 file name=+DATA/orcl/datafile/sysaux.347.1156020401
datafile 3 switched to datafile copy
input datafile copy RECID=32 STAMP=1156020468 file name=+DATA/orcl/datafile/undotbs1.343.1156020455
datafile 4 switched to datafile copy
input datafile copy RECID=33 STAMP=1156020468 file name=+DATA/orcl/datafile/users.377.1156020463
datafile 5 switched to datafile copy
input datafile copy RECID=34 STAMP=1156020468 file name=+DATA/orcl/datafile/undotbs2.346.1156020437
datafile 6 switched to datafile copy
input datafile copy RECID=35 STAMP=1156020468 file name=+DATA/orcl/datafile/prod.345.1156020443
datafile 7 switched to datafile copy
input datafile copy RECID=36 STAMP=1156020468 file name=+DATA/orcl/datafile/users.344.1156020451
datafile 8 switched to datafile copy
input datafile copy RECID=37 STAMP=1156020468 file name=+DATA/orcl/datafile/users.342.1156020457
datafile 9 switched to datafile copy
input datafile copy RECID=38 STAMP=1156020469 file name=+DATA/orcl/datafile/users.341.1156020459
datafile 10 switched to datafile copy
input datafile copy RECID=39 STAMP=1156020469 file name=+DATA/orcl/datafile/users.340.1156020461
datafile 11 switched to datafile copy
input datafile copy RECID=40 STAMP=1156020469 file name=+DATA/orcl/datafile/users.378.1156020461
datafile 12 switched to datafile copy
input datafile copy RECID=41 STAMP=1156020469 file name=+DATA/orcl/datafile/users.376.1156020463
datafile 13 switched to datafile copy
input datafile copy RECID=42 STAMP=1156020469 file name=+DATA/orcl/datafile/users.375.1156020465
Finished Duplicate Db at 19-DEC-23
2.8、RAC主库修改参数
增加RAC备库的参数,原有为primary,orcldg分别为RAC主库、DG单机
其中service对应tnsname里的名称,后面du_nique_name就是字面的意思了
alter system set log_archive_config='DG_CONFIG=(primary,orcl,orcldg)' scope=both;
alter system set log_archive_dest_3='service=racdg ASYNC NOAFFIRM valid_for=(online_logfiles,primary_role) db_unique_name=orcl' scope=both;
2.9、RAC备库启动同步进程
登录备库RAC节点,执行同步命令:
alter database recover managed standby database disconnect from session;
这个是停止的命令,需要的时候再用
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
这个是OPEN后,使用ADG同步的命令
alter database recover managed standby database using current logfile disconnect from session;
a)可以在静默创建命令后加参数(不太推荐,因为有个BUG:DBCA Silent Mode Is Not Setting DB_UNIQUE_NAME Even Though It Is Specified In DBCA Template File. (Doc ID 1508337.1),据说是模板文件的问题,导致命令行加参数修改不生效,如非要用这个方法,可以按我下面操作执行,我试了好几回终于成功了!):
.oracle层次查询(connect by)
oracle的emp表中包含了一列mgr指出谁是雇员的经理,由于经理也是雇员,所以经理的信息也存储在emp表中。这样emp表就是一个自引用表,表中的mgr列是一个自引用列,它指向emp表中的empno列,mgr表示一个员工的管理者,
select empno,mgr,ename,sal from e
SAPHANA平台有各种各样的应用场景,这也意味着客户的实施方法有许多种选择,关键是如何挑选最适合他们需求的实施方案。
在 《Implementing SAP HANA》这本书中,介绍了SAP平台在现实场景中的运作原理,并给出了实施建议和成功案例供参考。本系列文章节选自《Implementing SAP HANA》,介绍了行存储和列存储的各自特点,以及SAP HANA的数据存储方式如何提升空间压
学习Java有没有什么捷径?要想学好Java,首先要知道Java的大致分类。自从Sun推出Java以来,就力图使之无所不包,所以Java发展到现在,按应用来分主要分为三大块:J2SE,J2ME和J2EE,这也就是Sun ONE(Open Net Environment)体系。J2SE就是Java2的标准版,主要用于桌面应用软件的编程;J2ME主要应用于嵌入是系统开发,如手机和PDA的编程;J2EE
JSF 2.0 introduced annotation @ViewScoped; A bean annotated with this scope maintained its state as long as the user stays on the same view(reloads or navigation - no intervening views). One problem w
很多文档说Zookeeper是强一致性保证,事实不然。关于一致性模型请参考http://bit1129.iteye.com/blog/2155336
Zookeeper的数据同步协议
Zookeeper采用称为Quorum Based Protocol的数据同步协议。假如Zookeeper集群有N台Zookeeper服务器(N通常取奇数,3台能够满足数据可靠性同时
Spring Security提供了一个实现了可以缓存UserDetails的UserDetailsService实现类,CachingUserDetailsService。该类的构造接收一个用于真正加载UserDetails的UserDetailsService实现类。当需要加载UserDetails时,其首先会从缓存中获取,如果缓存中没