Lin Hong's TECH Blog! 刀不磨要生锈,人不学习要落后 - Thinking ahead

[原创]DB12cR2 Express设置

2017-07-17

[原创]DB12cR2_Express设置

从12c开始,DB control已经被Express替换。

EM express是一个非常简化版本Database control,仅提供最基本的数据库管理和性能监控管理。

例如如果你想做备份恢复,你只能通过cloud control(EMCC)来做,通过EM Express你可以view数据库的基本参数信息,存储信息,添加数据数据文件,表空间,用户管理等。

Express更加轻量,使用情况看下图汇总。

DB12c_Express

注意:

EM Express使用Shockwave Flash文件,所以浏览器必须安装flash插件,同时在你访问EM Express的时候监听必须是启动的。

特别注意:要访问的地址的操作系统防火墙是否关闭,或将访问端口添加到防火墙允许访问端口。

启动步骤

参考:

To manually configure the HTTP/HTTPS port for EM Express:
1- If the listener is running on a nonstandard port (for example, not 1521), then the init.ora file for the database you want to manage using EM Express must contain a local_listener entry so that the HTTP/HTTPS port can register with the correct listener. The local_listener entry references a TNSNAMES entry that points to the correct listener. For example:
	local_listener=inst1

where inst1 is a TNSNAMES entry defined in tnsnames.ora that points to the listener. For example:
	inst1= (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host_name)(PORT=1234))
	(CONNECT_DATA=(SERVICE_NAME=service_name)(SERVER=DEDICATED)))

2- Enable the TCP dispatcher by adding the following entry to the init.ora file for the database you want to manage using EM Express:
	dispatchers="(PROTOCOL=TCP)(SERVICE=<sid>XDB)"

	For example, if the database SID is ORCL, then the entry would be:
	dispatchers="(PROTOCOL=TCP)(SERVICE=ORCLXDB)"

3- Use the PL/SQL procedure DBMS_XDB_CONFIG.SETHTTPSPORT to set the HTTPS port for EM Express. This will update the HTTPS port in the xdbconfig.xml file in the Oracle XML DB Repository. You must connect as SYS / AS SYSDBA to run the procedure. For example:

SQL> connect sys/<password>@<container> as sysdba
SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5500);
or use the PL/SQL procedure DBMS_XDB_CONFIG.SETHTTPPORT to set the HTTP port for EM Express. This will update the HTTPS port in the xdbconfig.xml file in the Oracle XML DB Repository. You must connect as SYS / AS SYSDBA to run the procedure. For example:

SQL> connect sys/<password>@<container> as sysdba
SQL> exec DBMS_XDB_CONFIG.SETHTTPPORT(2200); 

监听和TNS等已经配置好,启动配置端口即可

SQL> startup
ORACLE instance started.

Total System Global Area 1610612736 bytes
Fixed Size                  8793304 bytes
Variable Size             520094504 bytes
Database Buffers         1073741824 bytes
Redo Buffers                7983104 bytes
Database mounted.
Database opened.
SQL> !lsnrctl start

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 17-JUL-2017 21:42:16

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

TNS-01106: Listener using listener name LISTENER has already been started

SQL> !lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 17-JUL-2017 21:42:22

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                17-JUL-2017 06:00:34
Uptime                    0 days 0 hr. 41 min. 49 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           ORCLCDB
Listener Parameter File   /opt/oracle/product/12.2.0.1/db_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/databasevm/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/ORCLCDB/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "4c2a110eb3662ffce055000000000001" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "ORCLCDB" has 2 instance(s).
  Instance "ORCLCDB", status UNKNOWN, has 1 handler(s) for this service...
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "ORCLCDBXDB" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "orclpdb1" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
The command completed successfully

SQL> select dbms_xdb_config.gethttpsport from dual;

GETHTTPSPORT
------------
		5500

SQL> exec dbms_xdb_config.sethttpsport(5500);

PL/SQL procedure successfully completed.

SQL> select dbms_xdb_config.gethttpsport from dual;

GETHTTPSPORT
------------
		5500

SQL> 

登陆Express

URL登陆页面:

For HTTPS:
SQL> SELECT 'https://'||SYS_CONTEXT('USERENV','SERVER_HOST')||'.'||SYS_CONTEXT('USERENV','DB_DOMAIN')||':'||dbms_xdb_config.gethttpsport()||'/em/' from dual;
SQL> SELECT 'https://'||SYS_CONTEXT('USERENV','SERVER_HOST')||':'||dbms_xdb_config.gethttpsport()||'/em/' from dual;

For HTTP :
SQL> SELECT 'http://'||SYS_CONTEXT('USERENV','SERVER_HOST')||'.'||SYS_CONTEXT('USERENV','DB_DOMAIN')||':'||dbms_xdb_config.gethttpport()||'/em/' from dual;
SQL> SELECT 'http://'||SYS_CONTEXT('USERENV','SERVER_HOST')||':'||dbms_xdb_config.gethttpport()||'/em/' from dual; 

只配置了HTTPS:

SQL> SELECT 'https://'||SYS_CONTEXT('USERENV','SERVER_HOST')||':'||dbms_xdb_config.gethttpsport()||'/em/' from dual;

'HTTPS://'||SYS_CONTEXT('USERENV','SERVER_HOST')||':'||DBMS_XDB_CONFIG.GETHTTPSP
--------------------------------------------------------------------------------
https://databasevm:5500/em/

SQL> SELECT 'http://'||SYS_CONTEXT('USERENV','SERVER_HOST')||':'||dbms_xdb_config.gethttpport()||'/em/' from dual; 

'HTTP://'||SYS_CONTEXT('USERENV','SERVER_HOST')||':'||DBMS_XDB_CONFIG.GETHTTPPOR
--------------------------------------------------------------------------------
http://databasevm:0/em/

SQL>

报错:requesting your username and password. The site says: “XDB”

DB12cR2 问题

https://127.0.0.1:5500 is requesting your username and password. The site says: “XDB”

Express_Problem

解决:

[3.4.3 Starting EM Express for a PDB](http://docs.oracle.com/database/122/ADMQS/getting-started-with-database-administration.htm#ADMQS12485)

Connect to the CDB$ROOT container for the CDB that includes the PDB, and issue the following SQL statement to configure the global port for the CDB:

exec dbms_xdb_config.setglobalportenabled(TRUE);

SQL> SELECT 'https://'||SYS_CONTEXT('USERENV','SERVER_HOST')||'.'||SYS_CONTEXT('USERENV','DB_DOMAIN')||':'||dbms_xdb_config.gethttpsport()||'/em/' from dual;

'HTTPS://'||SYS_CONTEXT('USERENV','SERVER_HOST')||'.'||SYS_CONTEXT('USERENV','DB
--------------------------------------------------------------------------------
https://databasevm.:5500/em/

SQL> exec dbms_xdb_config.setglobalportenabled(TRUE);

PL/SQL procedure successfully completed.

SQL>

成功画面:

Express_Problem


Similar Posts

Comments