启动虚拟机实例,等待安装界面显示,选择NETWORK & HOST NAME,Host name设置为ora12c.example.com。点击名称为enp0s3的网卡,选择Automatically connect to this network when it is available以自动启用系统中的第一块网卡。
说几句闲话,从Oracle Linux 7开始,网卡命名不再遵从原来的eth0, eth1, …, ethN,而是使用了一种可预测的命名方法:一致网络设备命名,systemd使用这种方法根据固件、拓扑以及位置信息分配固定名称,好处是即使添加或者删除硬件也不发送变化,而且可以毫无影响地替换破坏的硬件。缺点是名称比起之前的ethX难读。虽然通过修改uded规则可以改回原来的名称方式,但是本文不会这么做,也不推荐。
[root@ora12c ~]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2017-04-11 14:15:38 CST; 6min ago Docs: man:firewalld(1) Main PID: 644 (firewalld) CGroup: /system.slice/firewalld.service └─644 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Apr 11 14:15:37 ora12c.example.com systemd[1]: Starting firewalld - dynamic .... Apr 11 14:15:38 ora12c.example.com systemd[1]: Started firewalld - dynamic f.... Hint: Some lines were ellipsized, use -l to show in full. [root@ora12c ~]#
[root@ora12c ~]# cat /etc/pam.d/login #%PAM-1.0 auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so auth substack system-auth auth include postlogin account required pam_nologin.so account include system-auth password include system-auth # pam_selinux.so close should be the first session rule session required pam_selinux.so close session required pam_loginuid.so session optional pam_console.so # pam_selinux.so open should only be followed by sessions to be executed in the user context session required /lib64/security/pam_limits.so session required pam_limits.so session required pam_selinux.so open session required pam_namespace.so session optional pam_keyinit.so force revoke session include system-auth session include postlogin -session optional pam_ck_connector.so [root@ora12c ~]#
修改oracle用户的密码为oracle1234。
1 2 3 4 5 6 7
[root@ora12c ~]# passwd oracle Changing password for user oracle. New password: oracle1234 BAD PASSWORD: The password contains the user name in some form Retype new password: oracle1234 passwd: all authentication tokens updated successfully. [root@ora12c ~]#
#! /bin/sh -x # # chkconfig: 2345 80 05 # description: Oracle auto start-stop script. # # Set ORACLE_HOME to be equivalent to the $ORACLE_HOME # from which you wish to execute dbstart and dbshut; # # Set ORA_OWNER to the user id of the owner of the # Oracle database in ORACLE_HOME.
case"$1"in 'start') # Start the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values # Remove "&" if you don't want startup as a background process. su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" & touch /var/lock/subsys/dbora ;;
'stop') # Stop the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" & rm -f /var/lock/subsys/dbora ;; esac
修改启动脚本的权限:
1 2
# chgrp dba dbora # chmod 750 dbora
将启动脚本注册为自启动服务:
1 2
# chkconfig --add dbora # chkconfig dbora on
PDB Pluggable Database是12c中扛鼎的一个新特性, 但是对于CDB中的PDB,默认启动CDB时不会将所有的PDB带起来,这样我们就需要手动alter pluggable database ALL OPEN。解决方法就是使用SYS用户创建如下触发器:
1 2 3 4 5 6 7 8 9
[oracle@ora12c~]$ sqlplus /as sysdba
CREATETRIGGER open_all_pdbs AFTER STARTUP ON DATABASE BEGIN EXECUTE IMMEDIATE 'alter pluggable database all open'; END open_all_pdbs; /
SQL*Plus: Release 12.2.0.1.0 Production on Wed Apr 12 15:37:15 2017
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Enter password: Last Successful login time: Wed Apr 12 2017 15:08:54 +08:00
Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show parameter dispatchers
NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ dispatchers string (PROTOCOL=TCP) (SERVICE=orclXD B) max_dispatchers integer SQL> exec DBMS_XDB_CONFIG.setHTTPPort(5500);
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 12-APR-2017 15:39:53
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora12c.example.com)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production Start Date 12-APR-2017 14:58:34 Uptime 0 days 0 hr. 41 min. 19 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.example.com)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c.example.com)(PORT=5500))(Presentation=HTTP)(Session=RAW)) Services Summary... Service "4ce29b4f34122507e0537a4ea8c0bfe9.example.com" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "orcl.example.com" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "orclXDB.example.com" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "orclpdb.example.com" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... The command completed successfully [oracle@ora12c ~]$