[root@12col7-112 ~]# 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@12col7-112 ~]#
修改oracle用户的密码为welcome。
1 2 3 4 5 6 7
[root@12col7-112 ~]# passwd oracle Changing password for user oracle. New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd: all authentication tokens updated successfully. [root@12col7-112 ~]#
Checking Temp space: must be greater than 500 MB. Actual 39345 MB Passed Checking swap space: must be greater than 150 MB. Actual 3967 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-09-21_11-47-25AM. Please wait ...You can find the log of this install session at: /u01/app/oraInventory/logs/installActions2017-09-21_11-47-25AM.log
The installation of Oracle Database 12c was successful. Please check '/u01/app/oraInventory/logs/silentInstall2017-09-21_11-47-25AM.log' for more details.
As a root user, execute the following script(s): 1. /u01/app/oraInventory/orainstRoot.sh 2. /u01/app/oracle/product/12.2.0/dbhome_1/root.sh
Successfully Setup Software.
按照上面的说明,切换到root用户,执行这两个脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13
[oracle@12col7-112 ~]$ su - Password: Last login: Thu Sep 21 10:41:14 CST 2017 from 192.168.56.1 on pts/0 [root@12col7-112 ~]# /u01/app/oraInventory/orainstRoot.sh Changing permissions of /u01/app/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall. The execution of the script is complete. [root@12col7-112 ~]# /u01/app/oracle/product/12.2.0/dbhome_1/root.sh Check /u01/app/oracle/product/12.2.0/dbhome_1/install/root_12col7-112.example.com_2017-09-21_11-56-20-903254406.log for the output of root script [root@12col7-112 ~]#
[oracle@12col7-112 ~]$ dbca -silent \ > -createDatabase \ > -templateName General_Purpose.dbc \ > -gdbName orcl.example.com \ > -sid orcl \ > -createAsContainerDatabase true \ > -numberOfPdbs 1 \ > -pdbName pdb \ > -pdbadminUsername pdba \ > -pdbadminPassword welcome \ > -SysPassword welcome \ > -SystemPassword welcome \ > -emConfiguration NONE \ > -recoveryAreaDestination $ORACLE_BASE/recovery_area \ > -recoveryAreaSize 3200 \ > -characterSet "AL32UTF8" \ > -nationalCharacterSet "UTF-8" \ > -enableArchive true \ > -redoLogFileSize 100 [WARNING] [DBT-06801] Specified Fast Recovery Area size (3,200 MB) is less than the recommended value. CAUSE: Fast Recovery Area size should at least be three times the database size (2,430 MB). ACTION: Specify Fast Recovery Area Size to be at least three times the database size. [FATAL] [DBT-11152] National character set specified (UTF-8) is invalid. [oracle@12col7-112 ~]$ dbca -silent \ > -createDatabase \ > -templateName General_Purpose.dbc \ > -gdbName orcl.example.com \ > -sid orcl \ > -createAsContainerDatabase true \ > -numberOfPdbs 1 \ > -pdbName pdb \ > -pdbadminUsername pdba \ > -pdbadminPassword welcome \ > -SysPassword welcome \ > -SystemPassword welcome \ > -emConfiguration NONE \ > -recoveryAreaDestination $ORACLE_BASE/recovery_area \ > -characterSet "AL32UTF8" \ > -nationalCharacterSet "UTF8" \ > -enableArchive true \ > -redoLogFileSize 100 [WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards. CAUSE: a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. b.The password entered is a keyword that Oracle does not recommend to be used as password ACTION: Specify a strong password. If required refer Oracle documentation for guidelines. [WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards. CAUSE: a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. b.The password entered is a keyword that Oracle does not recommend to be used as password ACTION: Specify a strong password. If required refer Oracle documentation for guidelines. [WARNING] [DBT-06208] The 'PDBADMIN' password entered does not conform to the Oracle recommended standards. CAUSE: a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. b.The password entered is a keyword that Oracle does not recommend to be used as password ACTION: Specify a strong password. If required refer Oracle documentation for guidelines. Copying database files 1% complete 13% complete 25% complete Creating and starting Oracle instance 26% complete 30% complete 31% complete 35% complete 38% complete 39% complete 41% complete Completing Database Creation 42% complete 43% complete 44% complete 46% complete 49% complete 50% complete Creating Pluggable Databases 55% complete 75% complete Executing Post Configuration Actions 100% complete Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details. [oracle@12col7-112 ~]$
NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/orcl/control01.ctl /u01/app/oracle/recovery_area/orcl/control02.ctl
SQL> select member from v$logfile;
MEMBER -------------------------------------------------------------------------------- /u01/app/oracle/oradata/orcl/redo03.log /u01/app/oracle/oradata/orcl/redo02.log /u01/app/oracle/oradata/orcl/redo01.log
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 21-SEP-2017 15:00:49
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> status Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=12col7-112)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production Start Date 21-SEP-2017 14:59:54 Uptime 0 days 0 hr. 0 min. 59 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/12col7-112/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=12col7-112)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Services Summary... Service "59acf70353b0390ae0537038a8c0a3af.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 "pdb.example.com" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... The command completed successfully LSNRCTL>
SQL*Plus: Release 12.2.0.1.0 Production on Fri Sep 22 10:27:51 2017
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show con_name;
CON_NAME ------------------------------ CDB$RO
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB READ WRITE NO SQL>
创建表空间
在理解了以上概念之后,就明白要创建表空间,首先要切换到PDB中。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB READ WRITE NO SQL> alter session set container=PDB;
CON_NAME ------------------------------ PDB SQL> create user test01 identified by test01 default tablespace TEST01_TBS account unlock;
User created.
SQL> col username for a6 SQL> col default_tablespace for a15 SQL> col temporary_tablespace for a15 SQL> select username,default_tablespace,temporary_tablespace,account_status from dba_users where username like '%TEST01%';