虚拟机上静默安装ORACLE12C Non-CDB的DG

前端之家收集整理的这篇文章主要介绍了虚拟机上静默安装ORACLE12C Non-CDB的DG前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

虚拟机上静默安装ORACLE12C Non-CDB的DG


环境准备:
ubuntu16.04+kvm1.3.2
CentOS6.5 64bit

oracle 12c

test@vostro-2421:/media/test/mc2t/bak/kvm/dg$ qemu-img create -f qcow2 1.img -b cos6512c1src.img Formatting '1.img',fmt=qcow2 size=42949672960 backing_file=cos6512c1src.img encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16 test@vostro-2421:/media/test/mc2t/bak/kvm/dg$ qemu-img create -f qcow2 2.img -b cos6512c1src.img Formatting '2.img',fmt=qcow2 size=42949672960 backing_file=cos6512c1src.img encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16 3G内存40G硬盘未分区,由CENTOS6.5自动处理 database server->customize now->databases不安装MysqL.postgresql数据库->Desktops->Desktop.xwindowssystem->Development除eclipse,其他全安装。 vi /etc/hosts 192.168.122.114 dg1 192.168.122.115 dg2 1.规划 主库(192.168.122.114)dg1: db_name dg1 db_unique_name dg1 service_name dg1 instance_name dg1 本地归档路径 /u01/app/oracle/archivelog/ tnsnames dg2 --配置去备库的tns 备库(192.168.122.115)dg2: db_name dg1 db_unique_name dg2 servicer_name dg2 instance_name dg2 实例名可以不一样 本地归档路径 /u01/app/oracle/archivelog/ tnsnames dg1 --配置去主库的tns 2.安装ORACLE 重装oracle: shutdown immediate; lsnrctl stop echo '' > /etc/oratab rm -rf /u01 go1/2[脚本见我的另一文档] 1:/2:[1指dg1,2指dg2服务器] 安装oracle数据库 [oracle@dg1 shells]$ cat dbInstall1.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.1.0 oracle.install.option=INSTALL_DB_AND_CONFIG ORACLE_HOSTNAME=dg1 UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory SELECTED_LANGUAGES=en,zh_CN,zh_TW ORACLE_HOME=/u01/app/oracle/12c/dbhome ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oper oracle.install.db.BACKUPDBA_GROUP=dba oracle.install.db.DGDBA_GROUP=dba oracle.install.db.KMDBA_GROUP=dba oracle.install.db.rac.configurationType= oracle.install.db.CLUSTER_NODES= oracle.install.db.isRACOneInstall=false oracle.install.db.racOneServiceName= oracle.install.db.rac.serverpoolName= oracle.install.db.rac.serverpoolCardinality=0 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE oracle.install.db.config.starterdb.globalDBName=dg1 oracle.install.db.config.starterdb.SID=dg1 oracle.install.db.ConfigureAsContainerDB=true oracle.install.db.config.PDBName=pdbdg1 oracle.install.db.config.starterdb.characterSet=ZHT16HKSCS oracle.install.db.config.starterdb.memoryOption=true oracle.install.db.config.starterdb.memoryLimit=1003 oracle.install.db.config.starterdb.installExampleSchemas=false oracle.install.db.config.starterdb.password.ALL=123456 oracle.install.db.config.starterdb.password.SYS= oracle.install.db.config.starterdb.password.SYSTEM= oracle.install.db.config.starterdb.password.DBSNMP= oracle.install.db.config.starterdb.password.PDBADMIN= oracle.install.db.config.starterdb.managementOption=DEFAULT oracle.install.db.config.starterdb.omsHost= oracle.install.db.config.starterdb.omsPort=0 oracle.install.db.config.starterdb.emAdminUser= oracle.install.db.config.starterdb.emAdminPassword= oracle.install.db.config.starterdb.enableRecovery=true oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u01/app/oracle/oradata oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/u01/app/oracle/recovery_area oracle.install.db.config.asm.diskGroup= oracle.install.db.config.asm.ASMSNMPPassword= MYORACLESUPPORT_USERNAME= MYORACLESUPPORT_PASSWORD= SECURITY_UPDATES_VIA_MYORACLESUPPORT=false DECLINE_SECURITY_UPDATES=true PROXY_HOST= PROXY_PORT= PROXY_USER= PROXY_PWD= PROXY_REALM= COLLECTOR_SUPPORTHUB_URL= oracle.installer.autoupdates.option=SKIP_UPDATES oracle.installer.autoupdates.downloadUpdatesLoc= AUTOUPDATES_MYORACLESUPPORT_USERNAME= AUTOUPDATES_MYORACLESUPPORT_PASSWORD= [root@dg2 shells]# mount /dev/cdrom /media/disk [oracle@dg1 ~]$ /media/disk/database/runInstaller -silent -ignoreSysPrereqs -ignorePrereq -responseFile /home/shells/dbInstall1.rsp [oracle@dg2 shells]$ cat dbInstall2.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.1.0 oracle.install.option=INSTALL_DB_AND_CONFIG ORACLE_HOSTNAME=dg2 UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory SELECTED_LANGUAGES=en,zh_TW ORACLE_HOME=/u01/app/oracle/12c/dbhome ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oper oracle.install.db.BACKUPDBA_GROUP=dba oracle.install.db.DGDBA_GROUP=dba oracle.install.db.KMDBA_GROUP=dba oracle.install.db.rac.configurationType= oracle.install.db.CLUSTER_NODES= oracle.install.db.isRACOneInstall=false oracle.install.db.racOneServiceName= oracle.install.db.rac.serverpoolName= oracle.install.db.rac.serverpoolCardinality=0 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE oracle.install.db.config.starterdb.globalDBName=dg1 oracle.install.db.config.starterdb.SID=dg2 oracle.install.db.ConfigureAsContainerDB=true oracle.install.db.config.PDBName=pdbdg1 oracle.install.db.config.starterdb.characterSet=ZHT16HKSCS oracle.install.db.config.starterdb.memoryOption=true oracle.install.db.config.starterdb.memoryLimit=1003 oracle.install.db.config.starterdb.installExampleSchemas=false oracle.install.db.config.starterdb.password.ALL=123456 oracle.install.db.config.starterdb.password.SYS= oracle.install.db.config.starterdb.password.SYSTEM= oracle.install.db.config.starterdb.password.DBSNMP= oracle.install.db.config.starterdb.password.PDBADMIN= oracle.install.db.config.starterdb.managementOption=DEFAULT oracle.install.db.config.starterdb.omsHost= oracle.install.db.config.starterdb.omsPort=0 oracle.install.db.config.starterdb.emAdminUser= oracle.install.db.config.starterdb.emAdminPassword= oracle.install.db.config.starterdb.enableRecovery=true oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u01/app/oracle/oradata oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/u01/app/oracle/recovery_area oracle.install.db.config.asm.diskGroup= oracle.install.db.config.asm.ASMSNMPPassword= MYORACLESUPPORT_USERNAME= MYORACLESUPPORT_PASSWORD= SECURITY_UPDATES_VIA_MYORACLESUPPORT=false DECLINE_SECURITY_UPDATES=true PROXY_HOST= PROXY_PORT= PROXY_USER= PROXY_PWD= PROXY_REALM= COLLECTOR_SUPPORTHUB_URL= oracle.installer.autoupdates.option=SKIP_UPDATES oracle.installer.autoupdates.downloadUpdatesLoc= AUTOUPDATES_MYORACLESUPPORT_USERNAME= AUTOUPDATES_MYORACLESUPPORT_PASSWORD= [oracle@dg2 ~]$ /media/disk/database/runInstaller -silent -ignoreSysPrereqs -ignorePrereq -responseFile /home/shells/dbInstall2.rsp [oracle@dg1 shells]$ cat dbNetca1.rsp [GENERAL] RESPONSEFILE_VERSION="12.1" CREATE_TYPE="CUSTOM" [oracle.net.ca] INSTALLED_COMPONENTS={"server","net8","javavm"} INSTALL_TYPE=""custom"" LISTENER_NUMBER=1 LISTENER_NAMES={"DG1"} LISTENER_PROTOCOLS={"TCP;1521"} LISTENER_START=""DG1"" NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"} NSN_NUMBER=1 NSN_NAMES={"EXTPROC_CONNECTION_DATA"} NSN_SERVICE={"PLSExtProc"} NSN_PROTOCOLS={"TCP;HOSTNAME;1521"} [oracle@dg1 shells]$ $ORACLE_HOME/bin/netca -silent -responseFile /home/shells/dbNetca1.rsp [oracle@dg1 shells]$ cat dbca1.rsp [GENERAL] RESPONSEFILE_VERSION = "12.1.0" OPERATION_TYPE = "createDatabase" [CREATEDATABASE] GDBNAME = "dg1" SID = "dg1" TEMPLATENAME = "General_Purpose.dbc" [createTemplateFromDB] SOURCEDB = "myhost:1521:dg1" SYSDBAUSERNAME = "system" TEMPLATENAME = "My Copy TEMPLATE" [createCloneTemplate] SOURCEDB = "dg1" TEMPLATENAME = "My Clone TEMPLATE" [DELETEDATABASE] SOURCEDB = "dg1" [generateScripts] TEMPLATENAME = "New Database" GDBNAME = "dg1" [CONFIGUREDATABASE] [ADDINSTANCE] DB_UNIQUE_NAME = "dg1" NODELIST= SYSDBAUSERNAME = "sys" [DELETEINSTANCE] DB_UNIQUE_NAME = "dg1" INSTANCENAME = "dg1" SYSDBAUSERNAME = "sys" [CREATEPLUGGABLEDATABASE] SOURCEDB = "dg1" PDBNAME = "pdbdg1" [UNPLUGDATABASE] SOURCEDB = "dg1" PDBNAME = "pdbdg1" ARCHIVETYPE = "TAR" [oracle@dg1 ~]$ $ORACLE_HOME/bin/dbca -silent -createDatabase -responseFile /home/shells/dbca1.rsp -sysPassword 123456 -systemPassword 123456 [oracle@dg2 shells]$ cat dbNetca2.rsp [GENERAL] RESPONSEFILE_VERSION="12.1" CREATE_TYPE="CUSTOM" [oracle.net.ca] INSTALLED_COMPONENTS={"server","javavm"} INSTALL_TYPE=""custom"" LISTENER_NUMBER=1 LISTENER_NAMES={"DG2"} LISTENER_PROTOCOLS={"TCP;1521"} LISTENER_START=""DG2"" NAMING_METHODS={"TNSNAMES","HOSTNAME"} NSN_NUMBER=1 NSN_NAMES={"EXTPROC_CONNECTION_DATA"} NSN_SERVICE={"PLSExtProc"} NSN_PROTOCOLS={"TCP;HOSTNAME;1521"} [oracle@dg2 shells]$ $ORACLE_HOME/bin/netca -silent -responseFile /home/shells/dbNetca2.rsp [oracle@dg2 shells]$ cat dbca2.rsp [GENERAL] RESPONSEFILE_VERSION = "12.1.0" OPERATION_TYPE = "createDatabase" [CREATEDATABASE] GDBNAME = "dg1" SID = "dg2" TEMPLATENAME = "General_Purpose.dbc" [createTemplateFromDB] SOURCEDB = "myhost:1521:dg2" SYSDBAUSERNAME = "system" TEMPLATENAME = "My Copy TEMPLATE" [createCloneTemplate] SOURCEDB = "dg2" TEMPLATENAME = "My Clone TEMPLATE" [DELETEDATABASE] SOURCEDB = "dg2" [generateScripts] TEMPLATENAME = "New Database" GDBNAME = "dg1" [CONFIGUREDATABASE] [ADDINSTANCE] DB_UNIQUE_NAME = "dg2" NODELIST= SYSDBAUSERNAME = "sys" [DELETEINSTANCE] DB_UNIQUE_NAME = "dg2" INSTANCENAME = "dg2" SYSDBAUSERNAME = "sys" [CREATEPLUGGABLEDATABASE] SOURCEDB = "dg2" PDBNAME = "pdbdg1" [UNPLUGDATABASE] SOURCEDB = "dg2" PDBNAME = "pdbdg1" ARCHIVETYPE = "TAR" [oracle@dg1 shells]$ $ORACLE_HOME/bin/dbca -silent -createDatabase -responseFile /home/shells/dbca2.rsp -sysPassword 123456 -systemPassword 123456 ORACLE不会自动启动,运行dbSet.sh 3.设置DG数据库环境 dg1/2: sql> alter database force logging; Database altered. sql> select force_logging from v$database; sql> alter system set log_archive_dest_1='LOCATION=/u01/app/oracle/oradata/dg1/' scope=both; sql> alter database close; sql> alter database archivelog; sql> select GROUP#,MEMBERS,BYTES/1024/1024 from v$log; GROUP# MEMBERS BYTES/1024/1024 ---------- ---------- --------------- 1 1 50 3 1 50 2 1 50 sql> select GROUP#,MEMBER from v$logfile; GROUP# ---------- MEMBER -------------------------------------------------------------------------------- 3 /u01/app/oracle/oradata/dg1/redo03.log 2 /u01/app/oracle/oradata/dg1/redo02.log 1 /u01/app/oracle/oradata/dg1/redo01.log sql> alter database add standby logfile '/u01/app/oracle/oradata/dg1/stdredo1.log' size 50M; Database altered. sql> alter database add standby logfile '/u01/app/oracle/oradata/dg1/stdredo2.log' size 50M; Database altered. sql> alter database add standby logfile '/u01/app/oracle/oradata/dg1/stdredo3.log' size 50M; Database altered. sql> alter database add standby logfile '/u01/app/oracle/oradata/dg1/stdredo4.log' size 50M; Database altered. 4.修改SPFILE参数文件 [oracle@dg1 dbs]$ mkdir bak [oracle@dg1 dbs]$ cp *.* ./bak/ [oracle@dg1 dbs]$ cp *1 ./bak [oracle@dg1 dbs]$ ls bak hc_dg1.dat init.ora lkDG1 orapwdg1 spfiledg1.ora [oracle@dg1 dbs]$ ls bak hc_dg1.dat init.ora lkDG1 orapwdg1 spfiledg1.ora sql> create pfile from spfile; [oracle@dg1 dbs]$ ls bak hc_dg1.dat initdg1.ora init.ora lkDG1 orapwdg1 spfiledg1.ora [oracle@dg1/2 oracle]$ mkdir archivelog [oracle@dg1/2 archivelog]$ pwd /u01/app/oracle/archivelog dg1$ vi initdg1.ora添加 #primary dg1 DB_UNIQUE_NAME='dg1' log_archive_config='DG_CONFIG=(dg1,dg2)' log_archive_dest_1='LOCATION=/u01/app/oracle/archivelog/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dg1' LOG_ARCHIVE_DEST_2='SERVICE=dg2 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dg2' LOG_ARCHIVE_DEST_STATE_1=ENABLE LOG_ARCHIVE_DEST_STATE_2=ENABLE STANDBY_FILE_MANAGEMENT=AUTO dg2$ vi initdg2.ora添加 #standby dg2 DB_UNIQUE_NAME='dg2' log_archive_config='DG_CONFIG=(dg1,ALL_ROLES) DB_UNIQUE_NAME=dg2' LOG_ARCHIVE_DEST_STATE_1=ENABLE STANDBY_FILE_MANAGEMENT=AUTO log_file_name_convert='/u01/app/oracle/archivelog/archivelog','/u01/app/oracle/archivelog/archivelog' db_file_name_convert='/u01/app/oracle/archivelog/archivelog','/u01/app/oracle/archivelog/archivelog' 5.配置网络监听 [oracle@dg1 admin]$ pwd /u01/app/oracle/12c/dbhome/network/admin [oracle@dg1 admin]$ mkdir bak [oracle@dg1 admin]$ cp *.* bak/ [oracle@dg1 admin]$ ls bak listener.ora samples shrept.lst sqlnet.ora tnsnames.ora [oracle@dg1 admin]$ ls bak listener.ora shrept.lst sqlnet.ora tnsnames.ora 1$ vi tnsnames.ora DG1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.122.114)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg1) ) ) LISTENER_DG1 = (ADDRESS = (PROTOCOL = TCP)(HOST = dg1)(PORT = 1521)) DG2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.122.115)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg2) (UR=A) ) ) 2$ vi tnsnames.ora DG2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.122.115)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg2) (UR=A) ) ) LISTENER_DG2 = (ADDRESS = (PROTOCOL = TCP)(HOST = dg2)(PORT = 1521)) DG1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.122.114)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg1) ) ) 1$ vi listener.ora SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = dg1) (ORACLE_HOME = /u01/app/oracle/12c/dbhome) (SID_NAME = dg1) ) ) DG1 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dg1)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) 2$ vi listener.ora SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = dg1) (ORACLE_HOME = /u01/app/oracle/12c/dbhome) (SID_NAME = dg2) ) ) DG2 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dg2)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) 6.用新参数重新启动数据库 sql> shutdown immediate ORA-01109: database not open Database dismounted. ORACLE instance shut down. sql> create spfile from pfile; File created. sql> startup; ORACLE instance started. Total System Global Area 1269366784 bytes Fixed Size 2287912 bytes Variable Size 805308120 bytes Database Buffers 452984832 bytes Redo Buffers 8785920 bytes Database mounted. Database opened. [oracle@dg1 dbs]$ pwd /u01/app/oracle/12c/dbhome/dbs dg2: [oracle@dg2 dbs]$ ls bak hc_dg2.dat init.ora spfiledg2.ora lkDG2 orapwdg2 sql> create pfile from spfile; [oracle@dg2 dbs]$ ls bak hc_dg2.dat initdg2.ora lkDG2 orapwdg2 init.ora spfiledg2.ora $ vi initdg2.ora #standby dg2 DB_UNIQUE_NAME='dg2' log_archive_config='DG_CONFIG=(dg1,'/u01/app/oracle/archivelog/archivelog' [oracle@dg2 admin]$ vi listener.ora # listener.ora Network Configuration File: /u01/app/oracle/12c/dbhome/network/admin/listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = dg2) (ORACLE_HOME = /u01/app/oracle/12c/dbhome) (SID_NAME = dg2) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = dg2)(PORT = 1521)) ) ) [oracle@dg2 admin]$ vi tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/12c/dbhome/network/admin/tnsnames.ora # Generated by Oracle configuration tools. DG1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.122.4)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg1) ) ) DG2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.122.5)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg2) ) ) sql> create spfile from pfile; sql> startup nomount; 7.rman duplicate 复制数据库 ###[oracle@dg2 dbs]$ mkdir /u01/app/oracle/oradata/dg1/pdbdg1 shutdiwn immediate;startup nomount; dg2$ rman target sys/123456@dg1 auxiliary sys/123456@dg2 RMAN>duplicate target database for standby from active database nofilenamecheck dorecover; ...... archived log file name=/u01/app/oracle/oradata/dg1/archivelog1_57_924786787.dbf thread=1 sequence=57 media recovery complete,elapsed time: 00:02:46 Finished recover at 2016:10:12 13:45:07 Finished Duplicate Db at 2016:10:12 13:45:38 RMAN> 8.启动备库数据库 sql> alter database open; sql> select process,client_process,sequence#,status from v$managed_standby; PROCESS CLIENT_PROCESS SEQUENCE# STATUS ------------------ ---------------- ---------- ------------------------ ARCH ARCH 0 CONNECTED ARCH ARCH 0 CONNECTED ARCH ARCH 0 CONNECTED ARCH ARCH 0 CONNECTED sql> alter database recover managed standby database disconnect from session; sql> select process,status from v$managed_standby; PROCESS CLIENT_P SEQUENCE# STATUS --------- -------- ---------- ------------ ARCH ARCH 0 CONNECTED ARCH ARCH 0 CONNECTED ARCH ARCH 0 CONNECTED ARCH ARCH 0 CONNECTED MRP0 N/A 27 WAIT_FOR_LOG sql> select sequence#,applied from v$archived_log; SEQUENCE# APPLIED ---------- ------------------ 51 YES 52 YES 53 YES 重新启动主从后,在 主:alter system switch logfile; 从:alter database recover managed standby database disconnect from session; 9.测试DG dg1$ sqlplus / as sysdba sql> create tablespace mc datafile '/home/oracle/mc01.dbf' size 10M autoextend on next 5M maxsize 100M; Tablespace created. sql> CREATE USER mcc IDENTIFIED BY mcc DEFAULT TABLESPACE mc; User created. sql> grant connect,resource to mcc; Grant succeeded. sql> alter user mcc QUOTA unlimited ON mc TEMPORARY TABLESPACE temp; User altered. dg1$ sqlplus mcc/mcc sql> create table bb(a varchar(3),b varchar(3)); Table created. sql> insert into bb values('q','q'); 1 row created. sql> commit; Commit complete. dg2$ sqlplus mcc/mcc sql> desc bb; Name Null? Type ----------------------------------------- -------- ---------------------------- A VARCHAR2(3) B VARCHAR2(3) sql> select * from bb; A B ------ ------ q q sql> OK 附输出过程等信息: -------------------------------------------------------------- [oracle@dg1 ~]$ /media/disk/database/runInstaller -silent -ignoreSysPrereqs -ignorePrereq -responseFile /home/shells/dbInstall1.rsp Starting Oracle Universal Installer... Checking Temp space: must be greater than 500 MB. Actual 30326 MB Passed Checking swap space: must be greater than 150 MB. Actual 4031 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-10-17_01-53-11PM. Please wait ...[oracle@dg1 ~]$ [WARNING] [INS-30011] The ADMIN password entered does not conform to the Oracle recommended standards. CAUSE: 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]. ACTION: Provide a password that conforms to the Oracle recommended standards. You can find the log of this install session at: /u01/app/oraInventory/logs/installActions2016-10-17_01-53-11PM.log The installation of Oracle Database 12c was successful. Please check '/u01/app/oraInventory/logs/silentInstall2016-10-17_01-53-11PM.log' for more details. As a root user,execute the following script(s): 1. /u01/app/oraInventory/orainstRoot.sh 2. /u01/app/oracle/12c/dbhome/root.sh Successfully Setup Software. As install user,execute the following script to complete the configuration. 1. /u01/app/oracle/12c/dbhome/cfgtoollogs/configToolAllCommands RESPONSE_FILE=<response_file> Note: 1. This script must be run on the same host from where installer was run. 2. This script needs a small password properties file for configuration assistants that require passwords (refer to install guide documentation). [oracle@dg1 ~]$ exit logout [root@dg1 shells]# /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@dg1 shells]# /u01/app/oracle/12c/dbhome/root.sh Check /u01/app/oracle/12c/dbhome/install/root_dg1_2016-10-17_14-15-34.log for the output of root script [root@dg1 shells]# [oracle@dg1 shells]$ $ORACLE_HOME/bin/netca -silent -responseFile /home/shells/dbNetca1.rsp Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /home/shells/dbNetca1.rsp Done parsing command line arguments. Oracle Net Services Configuration: Configuring Listener:DG1 Listener configuration complete. Oracle Net Listener Startup: Running Listener Control: /u01/app/oracle/12c/dbhome/bin/lsnrctl start DG1 Listener Control complete. Listener started successfully. Profile configuration complete. Oracle Net Services configuration successful. The exit code is 0 [oracle@dg1 shells]$ $ORACLE_HOME/bin/dbca -silent -createDatabase -responseFile /home/shells/dbca1.rsp -sysPassword 123456 -systemPassword 123456 Copying database files 1% complete 3% complete 11% complete 18% complete 26% complete 33% complete 37% complete Creating and starting Oracle instance 40% complete 45% complete 50% complete 55% complete 56% complete 60% complete 62% complete Completing Database Creation 66% complete 70% complete 73% complete 85% complete 96% complete 100% complete Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/dg1/dg1.log" for further details. [oracle@dg2 shells]$ $ORACLE_HOME/bin/netca -silent -responseFile /home/shells/dbNetca2.rsp Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /home/shells/dbNetca2.rsp Done parsing command line arguments. Oracle Net Services Configuration: Configuring Listener:DG2 Listener configuration complete. Oracle Net Listener Startup: Running Listener Control: /u01/app/oracle/12c/dbhome/bin/lsnrctl start DG2 Listener Control complete. Listener started successfully. Profile configuration complete. Oracle Net Services configuration successful. The exit code is 0 [oracle@dg2 shells]$ $ORACLE_HOME/bin/dbca -silent -createDatabase -responseFile /home/shells/dbca2.rsp -sysPassword 123456 -systemPassword 123456 Copying database files 1% complete 3% complete 11% complete 18% complete 26% complete 33% complete 37% complete Creating and starting Oracle instance 40% complete 45% complete 50% complete 55% complete 56% complete 60% complete 62% complete Completing Database Creation 66% complete 70% complete 73% complete 85% complete 96% complete 100% complete Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/dg1/dg1.log" for further details. [oracle@dg2 shells]$ $ORACLE_HOME/bin/netca -silent -responseFile /home/shells/dbNetca2.rsp Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /home/shells/dbNetca2.rsp Done parsing command line arguments. Oracle Net Services Configuration: Configuring Listener:DG2 Listener configuration complete. Oracle Net Listener Startup: Running Listener Control: /u01/app/oracle/12c/dbhome/bin/lsnrctl start DG2 Listener Control complete. Listener started successfully. Profile configuration complete. Oracle Net Services configuration successful. The exit code is 0 必须修改1551为1521 [oracle@dg1 admin]$ cat bak/listener.ora # listener.ora Network Configuration File: /u01/app/oracle/12c/dbhome/network/admin/listener.ora # Generated by Oracle configuration tools. DG1 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dg1)(PORT = 1551)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1551)) ) ) 修改为: DG1 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dg1)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) [oracle@dg1 admin]$ cat bak/tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/12c/dbhome/network/admin/tnsnames.ora # Generated by Oracle configuration tools. DG1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dg1)(PORT = 1551)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg1) ) ) LISTENER_DG1 = (ADDRESS = (PROTOCOL = TCP)(HOST = dg1)(PORT = 1551)) 修改为: DG1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.122.114)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg1) ) ) LISTENER_DG1 = (ADDRESS = (PROTOCOL = TCP)(HOST = dg1)(PORT = 1521)) DG2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.122.115)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg2) ) ) ERROR: ORA-12528: TNS:listener: all appropriate instances are blocking new connections 1/2$ vi tnsnames.ora DG2为nomount 加 (UR=A) 1: test@vostro-2421:~$ ssh oracle@192.168.122.114 oracle@192.168.122.114's password: Last login: Tue Oct 18 13:36:32 2016 from 192.168.122.1 [oracle@dg1 ~]$ sqlplus / as sysdba sql*Plus: Release 12.1.0.1.0 Production on Thu Oct 20 10:37:22 2016 Copyright (c) 1982,2013,Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning,OLAP,Advanced Analytics and Real Application Testing options sql> desc v$log; Name Null? Type ----------------------------------------- -------- ---------------------------- GROUP# NUMBER THREAD# NUMBER SEQUENCE# NUMBER BYTES NUMBER BLOCKSIZE NUMBER MEMBERS NUMBER ARCHIVED VARCHAR2(3) STATUS VARCHAR2(16) FIRST_CHANGE# NUMBER FIRST_TIME DATE NEXT_CHANGE# NUMBER NEXT_TIME DATE CON_ID NUMBER sql> show parameter name NAME TYPE ------------------------------------ ---------------------- VALUE ------------------------------ cell_offloadgroup_name string db_file_name_convert string db_name string dg1 db_unique_name string dg1 global_names boolean NAME TYPE ------------------------------------ ---------------------- VALUE ------------------------------ FALSE instance_name string dg1 lock_name_space string log_file_name_convert string pdb_file_name_convert string NAME TYPE ------------------------------------ ---------------------- VALUE ------------------------------ processor_group_name string service_names string dg1 sql> select name from v$database; NAME ------------------ DG1 sql> select instance_name from v$instance; INSTANCE_NAME -------------------------------- dg1 sql> show parameter service_name; NAME TYPE ------------------------------------ ---------------------- VALUE ------------------------------ service_names string dg1 sql> select name,open_mode from v$pdbs; no rows selected sql> select dest_id,recovery_mode from v$archive_dest_status ; DEST_ID RECOVERY_MODE ---------- ---------------------------------------------- 1 IDLE 2 IDLE 3 IDLE 4 IDLE 5 IDLE 6 IDLE 7 IDLE 8 IDLE 9 IDLE 10 IDLE 11 IDLE DEST_ID RECOVERY_MODE ---------- ---------------------------------------------- 12 IDLE 13 IDLE 14 IDLE 15 IDLE 16 IDLE 17 IDLE 18 IDLE 19 IDLE 20 IDLE 21 IDLE 22 IDLE DEST_ID RECOVERY_MODE ---------- ---------------------------------------------- 23 IDLE 24 IDLE 25 IDLE 26 IDLE 27 IDLE 28 IDLE 29 IDLE 30 IDLE 31 IDLE 31 rows selected. sql> select name,value from v$parameter where name in ('log_archive_dest_1','log_archive_dest_2'); NAME -------------------------------------------------------------------------------- VALUE -------------------------------------------------------------------------------- log_archive_dest_1 LOCATION=/u01/app/oracle/archivelog/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES ) DB_UNIQUE_NAME=dg1 log_archive_dest_2 SERVICE=dg2 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=d g2 sql> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /u01/app/oracle/archivelog/archivelog Oldest online log sequence 10 Next log sequence to archive 12 Current log sequence 12 sql> select process,status,delay_mins from v$managed_standby; PROCESS STATUS SEQUENCE# DELAY_MINS ------------------ ------------------------ ---------- ---------- ARCH CLOSING 11 0 ARCH CLOSING 10 0 ARCH CLOSING 10 0 ARCH CLOSING 11 0 LNS WRITING 12 0 sql> select sequence#,applied,first_time,next_time from v$archived_log order by sequence#; SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 4 NO 2016:10:18 13:08:49 2016:10:18 15:21:58 5 NO 2016:10:18 15:21:58 2016:10:18 15:29:02 6 NO 2016:10:18 15:29:02 2016:10:18 17:20:59 7 NO 2016:10:18 17:20:59 2016:10:18 17:26:10 8 NO 2016:10:18 17:26:10 2016:10:18 17:26:13 9 NO 2016:10:18 17:26:13 2016:10:18 17:28:12 9 YES 2016:10:18 17:26:13 2016:10:18 17:28:12 10 NO 2016:10:18 17:28:12 2016:10:20 09:32:18 10 NO 2016:10:18 17:28:12 2016:10:20 09:32:18 11 NO 2016:10:20 09:32:18 2016:10:20 09:38:20 11 NO 2016:10:20 09:32:18 2016:10:20 09:38:20 11 rows selected. sql> alter system switch logfile; System altered. sql> select sequence#,next_time from v$archived_log order by sequence#; SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 4 NO 2016:10:18 13:08:49 2016:10:18 15:21:58 5 NO 2016:10:18 15:21:58 2016:10:18 15:29:02 6 NO 2016:10:18 15:29:02 2016:10:18 17:20:59 7 NO 2016:10:18 17:20:59 2016:10:18 17:26:10 8 NO 2016:10:18 17:26:10 2016:10:18 17:26:13 9 NO 2016:10:18 17:26:13 2016:10:18 17:28:12 9 YES 2016:10:18 17:26:13 2016:10:18 17:28:12 10 NO 2016:10:18 17:28:12 2016:10:20 09:32:18 10 NO 2016:10:18 17:28:12 2016:10:20 09:32:18 11 NO 2016:10:20 09:32:18 2016:10:20 09:38:20 11 NO 2016:10:20 09:32:18 2016:10:20 09:38:20 SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 12 NO 2016:10:20 09:38:20 2016:10:20 10:48:02 12 NO 2016:10:20 09:38:20 2016:10:20 10:48:02 13 rows selected. sql> alter system switch logfile; System altered. sql> sql> alter system switch logfile; System altered. sql> select sequence#,next_time from v$archived_log order by sequence#; SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 4 NO 2016:10:18 13:08:49 2016:10:18 15:21:58 5 NO 2016:10:18 15:21:58 2016:10:18 15:29:02 6 NO 2016:10:18 15:29:02 2016:10:18 17:20:59 7 NO 2016:10:18 17:20:59 2016:10:18 17:26:10 8 NO 2016:10:18 17:26:10 2016:10:18 17:26:13 9 NO 2016:10:18 17:26:13 2016:10:18 17:28:12 9 YES 2016:10:18 17:26:13 2016:10:18 17:28:12 10 NO 2016:10:18 17:28:12 2016:10:20 09:32:18 10 YES 2016:10:18 17:28:12 2016:10:20 09:32:18 11 NO 2016:10:20 09:32:18 2016:10:20 09:38:20 11 YES 2016:10:20 09:32:18 2016:10:20 09:38:20 SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 12 YES 2016:10:20 09:38:20 2016:10:20 10:48:02 12 NO 2016:10:20 09:38:20 2016:10:20 10:48:02 13 NO 2016:10:20 10:48:02 2016:10:20 10:52:03 13 NO 2016:10:20 10:48:02 2016:10:20 10:52:03 14 NO 2016:10:20 10:52:03 2016:10:20 10:52:14 14 NO 2016:10:20 10:52:03 2016:10:20 10:52:14 17 rows selected. sql> create tablespace mc datafile '/home/oracle/mc01.dbf' size 10M autoextend on next 5M maxsize 100M; Tablespace created. sql> CREATE USER c##mcc IDENTIFIED BY mcc DEFAULT TABLESPACE mc; CREATE USER c##mcc IDENTIFIED BY mcc DEFAULT TABLESPACE mc * ERROR at line 1: ORA-65094: invalid local user or role name sql> version SP2-0042: unknown command "version" - rest of line ignored. sql> create user mcc identified by mcc default tablespace mc; User created. sql> grant connect,resource to mcc; Grant succeeded. sql> quit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning,Advanced Analytics and Real Application Testing options [oracle@dg1 ~]$ sqlplus mcc/mcc sql*Plus: Release 12.1.0.1.0 Production on Thu Oct 20 10:55:29 2016 Copyright (c) 1982,Advanced Analytics and Real Application Testing options sql> create table bb(a varchar(3),'q'); insert into bb values('q','q') * ERROR at line 1: ORA-01950: no privileges on tablespace 'MC' sql> quit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning,Advanced Analytics and Real Application Testing options [oracle@dg1 ~]$ sqlplus / as sysdba sql*Plus: Release 12.1.0.1.0 Production on Thu Oct 20 10:56:03 2016 Copyright (c) 1982,Advanced Analytics and Real Application Testing options sql> alter user mcc quota unlimited on mc temporary tablespace temp; User altered. sql> quit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning,Advanced Analytics and Real Application Testing options [oracle@dg1 ~]$ sqlplus mcc/mcc sql*Plus: Release 12.1.0.1.0 Production on Thu Oct 20 10:57:48 2016 Copyright (c) 1982,Oracle. All rights reserved. Last Successful login time: Thu Oct 20 2016 10:55:29 +08:00 Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning,Advanced Analytics and Real Application Testing options sql> insert into bb values('q','q'); 1 row created. sql> commit; Commit complete. sql> quit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning,Advanced Analytics and Real Application Testing options [oracle@dg1 ~]$ sql> select name,decode(cdb,'YES','Multitenant Option enabled','Regular 12c Database: ') "Multitenant Option",open_mode,con_id from v$database; NAME Multitenant Option ------------------ ---------------------------------------------------- OPEN_MODE CON_ID ---------------------------------------- ---------- DG1 Regular 12c Database: READ WRITE 0 sql> select sys_context('userenv','con_name') "Container DB" from dual; Container DB -------------------------------------------------------------------------------- dg1 sql> show con_name; CON_NAME ------------------------------ Non Consolidated sql> select con_id,dbid,guid,name,open_mode from v$pdbs; no rows selected sql> 2: [oracle@dg2 ~]$ sqlplus / as sysdba sql*Plus: Release 12.1.0.1.0 Production on Thu Oct 20 10:38:07 2016 Copyright (c) 1982,Advanced Analytics and Real Application Testing options sql> desc v$logfile; Name Null? Type ----------------------------------------- -------- ---------------------------- GROUP# NUMBER STATUS VARCHAR2(7) TYPE VARCHAR2(7) MEMBER VARCHAR2(513) IS_RECOVERY_DEST_FILE VARCHAR2(3) CON_ID NUMBER sql> show parameter name NAME TYPE ------------------------------------ ---------------------- VALUE ------------------------------ cell_offloadgroup_name string db_file_name_convert string /u01/app/oracle/archivelog/arc hivelog,/u01/app/oracle/archi velog/archivelog db_name string dg1 db_unique_name string NAME TYPE ------------------------------------ ---------------------- VALUE ------------------------------ dg2 global_names boolean FALSE instance_name string dg2 lock_name_space string log_file_name_convert string /u01/app/oracle/archivelog/arc NAME TYPE ------------------------------------ ---------------------- VALUE ------------------------------ hivelog,/u01/app/oracle/archi velog/archivelog pdb_file_name_convert string processor_group_name string service_names string dg2 sql> select name from v$database; NAME ------------------ DG1 sql> select instance_name from v$instance; INSTANCE_NAME -------------------------------- dg2 sql> show parameter service_name; NAME TYPE ------------------------------------ ---------------------- VALUE ------------------------------ service_names string dg2 sql> select name,recovery_mode from v$archive_dest_status ; DEST_ID RECOVERY_MODE ---------- ---------------------------------------------- 1 IDLE 2 IDLE 3 IDLE 4 IDLE 5 IDLE 6 IDLE 7 IDLE 8 IDLE 9 IDLE 10 IDLE 11 IDLE DEST_ID RECOVERY_MODE ---------- ---------------------------------------------- 12 IDLE 13 IDLE 14 IDLE 15 IDLE 16 IDLE 17 IDLE 18 IDLE 19 IDLE 20 IDLE 21 IDLE 22 IDLE DEST_ID RECOVERY_MODE ---------- ---------------------------------------------- 23 IDLE 24 IDLE 25 IDLE 26 IDLE 27 IDLE 28 IDLE 29 IDLE 30 IDLE 31 IDLE 32 IDLE 32 rows selected. sql> select name,ALL_ROLES ) DB_UNIQUE_NAME=dg2 log_archive_dest_2 sql> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /u01/app/oracle/archivelog/archivelog Oldest online log sequence 10 Next log sequence to archive 0 Current log sequence 12 sql> select process,delay_mins from v$managed_standby; PROCESS STATUS SEQUENCE# DELAY_MINS ------------------ ------------------------ ---------- ---------- ARCH CONNECTED 0 0 ARCH CONNECTED 0 0 ARCH CONNECTED 0 0 ARCH CONNECTED 0 0 RFS IDLE 0 0 RFS IDLE 0 0 RFS IDLE 12 0 7 rows selected. sql> select sequence#,next_time from v$archived_log order by sequence#; SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 7 YES 2016:10:18 17:20:59 2016:10:18 17:26:10 8 YES 2016:10:18 17:26:10 2016:10:18 17:26:13 9 YES 2016:10:18 17:26:13 2016:10:18 17:28:12 10 NO 2016:10:18 17:28:12 2016:10:20 09:32:18 11 NO 2016:10:20 09:32:18 2016:10:20 09:38:20 sql> select sequence#,next_time from v$archived_log order by sequence#; SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 7 YES 2016:10:18 17:20:59 2016:10:18 17:26:10 8 YES 2016:10:18 17:26:10 2016:10:18 17:26:13 9 YES 2016:10:18 17:26:13 2016:10:18 17:28:12 10 NO 2016:10:18 17:28:12 2016:10:20 09:32:18 11 NO 2016:10:20 09:32:18 2016:10:20 09:38:20 12 NO 2016:10:20 09:38:20 2016:10:20 10:48:02 6 rows selected. sql> alter database recover managed standby database using current logfile disconnect from session; Database altered. sql> select sequence#,next_time from v$archived_log order by sequence#; SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 7 YES 2016:10:18 17:20:59 2016:10:18 17:26:10 8 YES 2016:10:18 17:26:10 2016:10:18 17:26:13 9 YES 2016:10:18 17:26:13 2016:10:18 17:28:12 10 IN-MEMORY 2016:10:18 17:28:12 2016:10:20 09:32:18 11 NO 2016:10:20 09:32:18 2016:10:20 09:38:20 12 NO 2016:10:20 09:38:20 2016:10:20 10:48:02 6 rows selected. sql> select sequence#,next_time from v$archived_log order by sequence#; SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 7 YES 2016:10:18 17:20:59 2016:10:18 17:26:10 8 YES 2016:10:18 17:26:10 2016:10:18 17:26:13 9 YES 2016:10:18 17:26:13 2016:10:18 17:28:12 10 YES 2016:10:18 17:28:12 2016:10:20 09:32:18 11 IN-MEMORY 2016:10:20 09:32:18 2016:10:20 09:38:20 12 IN-MEMORY 2016:10:20 09:38:20 2016:10:20 10:48:02 6 rows selected. sql> select sequence#,next_time from v$archived_log order by sequence#; SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 7 YES 2016:10:18 17:20:59 2016:10:18 17:26:10 8 YES 2016:10:18 17:26:10 2016:10:18 17:26:13 9 YES 2016:10:18 17:26:13 2016:10:18 17:28:12 10 YES 2016:10:18 17:28:12 2016:10:20 09:32:18 11 IN-MEMORY 2016:10:20 09:32:18 2016:10:20 09:38:20 12 YES 2016:10:20 09:38:20 2016:10:20 10:48:02 13 IN-MEMORY 2016:10:20 10:48:02 2016:10:20 10:52:03 7 rows selected. sql> sql> select sequence#,next_time from v$archived_log order by sequence#; SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 7 YES 2016:10:18 17:20:59 2016:10:18 17:26:10 8 YES 2016:10:18 17:26:10 2016:10:18 17:26:13 9 YES 2016:10:18 17:26:13 2016:10:18 17:28:12 10 YES 2016:10:18 17:28:12 2016:10:20 09:32:18 11 IN-MEMORY 2016:10:20 09:32:18 2016:10:20 09:38:20 12 YES 2016:10:20 09:38:20 2016:10:20 10:48:02 13 IN-MEMORY 2016:10:20 10:48:02 2016:10:20 10:52:03 14 IN-MEMORY 2016:10:20 10:52:03 2016:10:20 10:52:14 8 rows selected. sql> select sequence#,next_time from v$archived_log order by sequence#; SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 7 YES 2016:10:18 17:20:59 2016:10:18 17:26:10 8 YES 2016:10:18 17:26:10 2016:10:18 17:26:13 9 YES 2016:10:18 17:26:13 2016:10:18 17:28:12 10 YES 2016:10:18 17:28:12 2016:10:20 09:32:18 11 IN-MEMORY 2016:10:20 09:32:18 2016:10:20 09:38:20 12 YES 2016:10:20 09:38:20 2016:10:20 10:48:02 13 YES 2016:10:20 10:48:02 2016:10:20 10:52:03 14 IN-MEMORY 2016:10:20 10:52:03 2016:10:20 10:52:14 8 rows selected. sql> select sequence#,next_time from v$archived_log order by sequence#; SEQUENCE# APPLIED FIRST_TIME NEXT_TIME ---------- ------------------ ------------------- ------------------- 7 YES 2016:10:18 17:20:59 2016:10:18 17:26:10 8 YES 2016:10:18 17:26:10 2016:10:18 17:26:13 9 YES 2016:10:18 17:26:13 2016:10:18 17:28:12 10 YES 2016:10:18 17:28:12 2016:10:20 09:32:18 11 IN-MEMORY 2016:10:20 09:32:18 2016:10:20 09:38:20 12 YES 2016:10:20 09:38:20 2016:10:20 10:48:02 13 YES 2016:10:20 10:48:02 2016:10:20 10:52:03 14 IN-MEMORY 2016:10:20 10:52:03 2016:10:20 10:52:14 8 rows selected. sql> quit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning,Advanced Analytics and Real Application Testing options [oracle@dg2 ~]$ sqlplus mcc/mcc sql*Plus: Release 12.1.0.1.0 Production on Thu Oct 20 10:58:42 2016 Copyright (c) 1982,Oracle. All rights reserved. Last Successful login time: Thu Oct 20 2016 10:57:48 +08:00 Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning,Advanced Analytics and Real Application Testing options sql> desc bb; Name Null? Type ----------------------------------------- -------- ---------------------------- A VARCHAR2(3) B VARCHAR2(3) sql> select * from bb; A B ------ ------ q q sql> quit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning,Advanced Analytics and Real Application Testing options [oracle@dg2 ~]$ ll total 10280 drwxr-xr-x 2 oracle oinstall 4096 10月 18 15:56 Desktop drwxr-xr-x 2 oracle oinstall 4096 10月 18 15:56 Documents drwxr-xr-x 2 oracle oinstall 4096 10月 18 15:56 Downloads -rw-r----- 1 oracle oinstall 10493952 10月 20 10:58 mc01.dbf drwxr-xr-x 2 oracle oinstall 4096 10月 18 15:56 Music drwxr-xr-x 2 oracle oinstall 4096 10月 18 15:56 Pictures drwxr-xr-x 2 oracle oinstall 4096 10月 18 15:56 Public drwxr-xr-x 2 oracle oinstall 4096 10月 18 15:56 Templates drwxr-xr-x 2 oracle oinstall 4096 10月 18 15:56 Videos sql> select dbms_xdb_config.gethttpsport from dual; GETHTTPSPORT ------------ sql> select name,con_id from v$database; NAME Multitenant Option ------------------ ---------------------------------------------------- OPEN_MODE CON_ID ---------------------------------------- ---------- DG1 Regular 12c Database: READ ONLY WITH APPLY 0 sql> select sys_context('userenv','con_name') "Container DB" from dual; Container DB -------------------------------------------------------------------------------- dg1 sql> show con_name; CON_NAME ------------------------------ Non Consolidated sql> ------------------------ 10.参考: http://blog.csdn.net/knuuy/article/details/47154571 http://blog.csdn.net/tianlesoftware/article/details/41675139 原文链接:https://www.f2er.com/oracle/212172.html

猜你在找的Oracle相关文章