Oracle 11g RAC 安装EM
emca帮助信息
1 | [oracle@11rac2 ~]$ emca -h |
emctl帮助信息
1 | [oracle@11rac2 ~]$ emctl -h |
em运行日志
1 | [oracle@11rac2 config]$ ll /u01/app/oracle/product/11.2.0/dbhome_1/11rac2_racdb/sysman/log/ |
手动清除并新建
1 | emca -deconfig dbcontrol db -repos drop -cluster |
注意:以上命令清除RAC数据库旧配置信息,但是会使数据库进入静默模式,锁定所有用户,在生产环境是不允许的。因此需要分两步进行配置:(不会进入静默模式)
手动删除旧配置信息
1
2
3
4
5
6
7su - oracle
sqlplus / as sysdba
drop user sysman cascade;
drop role MGMT_USER;
drop user MGMT_VIEW cascade;
drop public synonym MGMT_TARGET_BLACKOUTS;
drop public synonym SETEMVIEWUSERCONTEXT;重新建立RAC数据库db control 配置信息
1
2su - oracle
emca -config dbcontrol db -repos create -cluster
重建
注意:重建会先删除再创建,删除过程会将数据库进入静默状态,生产库切勿如此。因此要么直接创建,要么使用上面的两步骤方式,手动删除旧配置信息,然后再创建。
节点hosts文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17[oracle@11rac1 ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# Public
10.10.10.171 11rac1
10.10.10.172 11rac2
# Private
172.16.1.171 11rac1-priv
172.16.1.172 11rac2-priv
# Virtual
10.10.10.173 11rac1-vip
10.10.10.174 11rac2-vip
# SCAN
10.10.10.175 rac-scan
10.10.10.176 rac-scan
10.10.10.177 rac-scan
[oracle@11rac1 ~]$创建asmsnmp用户:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21-- grid用户
[grid@11rac1 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 2 14:47:35 2025
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> create user asmsnmp identified by SysPassword1;
create user asmsnmp identified by SysPassword1
*
ERROR at line 1:
ORA-15306: ASM password file update failed on at least one node
ORA-15321: cannot set attribute with connected clients
SQL>解决方法如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34[grid@11rac1 dbs]$ pwd
/u01/app/11.2.0/grid/dbs
[grid@11rac1 dbs]$ ll
total 12
-rw-rw---- 1 grid oinstall 931 Mar 27 16:26 ab_+ASM1.dat
-rw-rw---- 1 grid oinstall 1544 Mar 27 16:27 hc_+ASM1.dat
-rw-r--r-- 1 grid oinstall 2851 May 15 2009 init.ora
[grid@11rac1 dbs]$
# 创建密码文件
[grid@11rac1 dbs]$ orapwd file='orapw+ASM1' entries=5 password=SysPassword1
[grid@11rac1 dbs]$ ll
total 16
-rw-rw---- 1 grid oinstall 931 Mar 27 16:26 ab_+ASM1.dat
-rw-rw---- 1 grid oinstall 1544 Mar 27 16:27 hc_+ASM1.dat
-rw-r--r-- 1 grid oinstall 2851 May 15 2009 init.ora
-rw-r----- 1 grid oinstall 2048 Apr 2 14:54 orapw+ASM1
[grid@11rac1 dbs]$
# 复制到其它节点
[grid@11rac1 dbs]$ scp orapw+ASM1 grid@11rac2:/u01/app/11.2.0/grid/dbs/
orapw+ASM1 100% 2048 542.7KB/s 00:00
# 节点2更改文件名
[grid@11rac2 dbs]$ pwd
/u01/app/11.2.0/grid/dbs
[grid@11rac2 dbs]$ mv orapw+ASM1 orapw+ASM2
[grid@11rac2 dbs]$ ll
total 16
-rw-rw----. 1 grid oinstall 931 Mar 27 16:27 ab_+ASM2.dat
-rw-rw----. 1 grid oinstall 1544 Mar 27 16:27 hc_+ASM2.dat
-rw-r--r--. 1 grid oinstall 2851 May 27 2024 init.ora
-rw-r-----. 1 grid oinstall 2048 Apr 2 14:55 orapw+ASM2
[grid@11rac2 dbs]$再次执行:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16SQL> create user asmsnmp identified by SysPassword1;
User created.
SQL> grant sysdba to asmsnmp;
Grant succeeded.
SQL> select * from v$pwfile_users;
USERNAME SYSDB SYSOP SYSAS
------------------------------ ----- ----- -----
SYS TRUE TRUE FALSE
ASMSNMP TRUE FALSE FALSE
SQL>ASM实例注册于listener_scan1:
1
2alter system set remote_listener='rac-scan:1521' scope=both sid='*';
alter system register;查看cluster name:
1
2
3[grid@11rac1 dbs]$ /u01/app/11.2.0/grid/bin/cemutlo -n
rac11-cluster
[grid@11rac1 dbs]$重建EM:
1
2su - oracle
emca -config dbcontrol db -repos recreate -cluster示例输出:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112[oracle@11rac1 ~]$ emca -config dbcontrol db -repos recreate -cluster
STARTED EMCA at Apr 2, 2025 3:09:18 PM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle. All rights reserved.
Enter the following information:
Database unique name: racdb # 注意这里是db_name,而非dg环境中的db_unique_name
Service name: racdb_primary
Listener port number: 1521
Listener ORACLE_HOME [ /u01/app/11.2.0/grid ]:
Password for SYS user:
Password for DBSNMP user: # 这几个账户默认是锁定的,需要手动解锁
Password for SYSMAN user:
Password for SYSMAN user:
Cluster name: rac11-cluster
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
ASM ORACLE_HOME [ /u01/app/11.2.0/grid ]:
ASM port [ 1521 ]:
ASM username [ ASMSNMP ]:
ASM user password:
-----------------------------------------------------------------
You have specified the following settings
Database ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/dbhome_1
Database instance hostname ................ Listener ORACLE_HOME ................ /u01/app/11.2.0/grid
Listener port number ................ 1521
Cluster name ................ rac11-cluster
Database unique name ................ racdb
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
ASM ORACLE_HOME ................ /u01/app/11.2.0/grid
ASM port ................ 1521
ASM user role ................ SYSDBA
ASM username ................ ASMSNMP
-----------------------------------------------------------------
----------------------------------------------------------------------
WARNING : While repository is dropped the database will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: Y
Apr 2, 2025 3:11:05 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/racdb/emca_2025_04_02_15_09_17.log.
Apr 2, 2025 3:11:13 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Apr 2, 2025 3:22:36 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Apr 2, 2025 3:22:37 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Apr 2, 2025 3:44:17 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Apr 2, 2025 3:44:30 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Apr 2, 2025 3:48:05 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Apr 2, 2025 3:48:06 PM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
INFO: Propagating /u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_11rac1_racdb to remote nodes ...
Apr 2, 2025 3:48:11 PM oracle.sysman.emcp.EMDBCConfig instantiateOC4JConfigFiles
INFO: Propagating /u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_11rac2_racdb to remote nodes ...
Apr 2, 2025 3:48:22 PM oracle.sysman.emcp.EMAgentConfig deployStateDirs
INFO: Propagating /u01/app/oracle/product/11.2.0/dbhome_1/11rac1_racdb to remote nodes ...
Apr 2, 2025 3:48:29 PM oracle.sysman.emcp.EMAgentConfig deployStateDirs
INFO: Propagating /u01/app/oracle/product/11.2.0/dbhome_1/11rac2_racdb to remote nodes ...
Apr 2, 2025 3:48:39 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Apr 2, 2025 3:49:59 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Apr 2, 2025 3:53:11 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Apr 2, 2025 3:53:11 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://11rac1:1158/em <<<<<<<<<<<
Apr 2, 2025 3:53:29 PM oracle.sysman.emcp.EMDBPostConfig showClusterDBCAgentMessage
INFO:
**************** Current Configuration ****************
INSTANCE NODE DBCONTROL_UPLOAD_HOST
---------- ---------- ---------------------
racdb 11rac1 11rac1
racdb 11rac2 11rac1
Apr 2, 2025 3:53:29 PM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING:
************************ WARNING ************************
Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted. The encryption key has been placed in the file: /u01/app/oracle/product/11.2.0/dbhome_1/11rac1_racdb/sysman/config/emkey.ora. Ensure this file is backed up as the encrypted data will become unusable if this file is lost.
***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Apr 2, 2025 3:53:29 PM
[oracle@11rac1 ~]$
# 看下状态,如下可以看到已经自动启动,但仅在节点1上运行
[oracle@11rac1 ~]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
https://11rac1:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/11rac1_racdb/sysman/log
[oracle@11rac1 ~]$
[oracle@11rac2 ~]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
https://11rac1:1158/em/console/aboutApplication
EM Daemon is running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/11rac2_racdb/sysman/log
[oracle@11rac2 ~]$访问
注意:建议适用节点IP进行访问,因为如果适用SCAN-IP或VIP,可能会被切换到没有运行em的节点上。
1
https://node-ip:1158
如下所示: