您好,登錄后才能下訂單哦!
Oracle Study之-Oracle 11g OCM考試(1)
系統(tǒng)環(huán)境:RedHat EL64
Oracle: Oracle 11gR2
Oracle 11g OCM考試第一題,手工建庫,參考文檔。參考人員必須對文檔非常熟悉,才可以在指定的時(shí)間內(nèi)完成任務(wù)。
一、查看系統(tǒng)環(huán)境
[oracle@rh74 ~]$ cat .bash_profile
# .bash_profile export EDITOR=vi export ORACLE_SID=prod export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export LD_LIBRARY_PATH=$ORACLE_HOME/lib export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin umask 022
[oracle@rh74 ~]$ id oracle
uid=300(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)
2、建立數(shù)據(jù)庫pfile文件
[oracle@rh74 dbs]$ pwd
/u01/app/oracle/product/11.2.0/db_1/dbs
[oracle@rh74 dbs]$ ls
hc_DBUA3908922.dat init.bk inittest2.ora lkTEST2 orapwtest2
hc_prod.dat initDBUA3908922.ora inittest.ora orapwDBUA3908922 snapcf_prod.f
hc_test2.dat init.ora lkPROD orapwprod spfileprod.ora
hc_test.dat initprod.ora lkTEST orapwtest spfiletest2.ora
[oracle@rh74 dbs]$ cat init.ora |grep -v "^#"|grep -v "^$" >inittest1.ora
編輯pfile文件:
[oracle@rh74 dbs]$ cat inittest1.ora
db_name='test1' memory_target=300m processes = 150 audit_file_dest='$ORACLE_BASE/admin/test1/adump' audit_trail ='db' db_block_size=8192 db_domain='' diagnostic_dest=$ORACLE_BASE open_cursors=300 remote_login_passwordfile='EXCLUSIVE' undo_tablespace='UNDOTBS1' control_files ='/u01/app/oracle/oradata/test1/control01.ctl' compatible ='11.2.0'
建立相應(yīng)的目錄:
[oracle@rh74 dbs]$ mkdir -p /u01/app/oracle/admin/test1/adump
[oracle@rh74 dbs]$ mkdir -p /u01/app/oracle/oradata/test1
建立 Instance 口令文件:
[oracle@rh74 dbs]$ orapwd file=orapwtest1 password=oracle entries=3
建立建庫腳本:
參考:
[oracle@rh74 ~]$ cat cr_db.sql
CREATE DATABASE test1 USER SYS IDENTIFIED BY oracle USER SYSTEM IDENTIFIED BY oracle LOGFILE GROUP 1 ('/u01/app/oracle/oradata/test1/redo01a.log') SIZE 100M BLOCKSIZE 512, GROUP 2 ('/u01/app/oracle/oradata/test1/redo02a.log') SIZE 100M BLOCKSIZE 512 MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 CHARACTER SET zhs16gbk EXTENT MANAGEMENT LOCAL DATAFILE '/u01/app/oracle/oradata/test1/system01.dbf' SIZE 325M REUSE SYSAUX DATAFILE '/u01/app/oracle/oradata/test1/sysaux01.dbf' SIZE 325M REUSE DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE '/u01/app/oracle/oradata/test1/temp01.dbf' SIZE 20M REUSE UNDO TABLESPACE undotbs1 DATAFILE '/u01/app/oracle/oradata/test1/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
3、啟動(dòng)Instance到nomount,運(yùn)行建庫腳本:
[oracle@rh74 ~]$ export ORACLE_SID=test1
[oracle@rh74 ~]$ sqlplus '/as sysdba' SQL*Plus: Release 11.2.0.3.0 Production on Fri Apr 8 17:09:02 2016 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to an idle instance. 17:09:02 SYS@ test1>startup nomount; ORACLE instance started. Total System Global Area 313159680 bytes Fixed Size 2227944 bytes Variable Size 218104088 bytes Database Buffers 88080384 bytes Redo Buffers 4747264 bytes 17:14:17 SYS@ test1>select status from v$instance; STATUS ------------ STARTED
17:15:15 SYS@ test1>@/home/oracle/cr_db.sql
Database created.
4、建庫完成后,通過腳本建立數(shù)據(jù)字典
[oracle@rh74 ~]$ cat cr_dict.sql
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
conn system/oracle
@?/sqlplus/admin/pupbld.sql
17:31:44 SYS@ test1>@/home/oracle/cr_dict.sql
5、建庫成功,建立default tablespace
19:24:34 SYSTEM@ test1>create tablespace users
datafile '/u01/app/oracle/oradata/test1/users01.dbf' size 100m;
Tablespace created.
19:25:57 SYSTEM@ test1>alter database default tablespace users;
Database altered.
19:27:52 SYSTEM@ test1>select tablespace_name,file_id,file_name from dba_data_files;
TABLESPACE_NAME FILE_ID FILE_NAME ------------------------------ ---------- -------------------------------- SYSTEM 1 /u01/app/oracle/oradata/test1/system01.dbf SYSAUX 2 /u01/app/oracle/oradata/test1/sysaux01.dbf UNDOTBS1 3 /u01/app/oracle/oradata/test1/undotbs01.dbf USERS 4 /u01/app/oracle/oradata/test1/users01.dbf 4 rows selected.
6、配置網(wǎng)絡(luò)(tnsnames)
[oracle@rh74 admin]$ cat tnsnames.ora
TEST1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rh74)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test1) ) )
[oracle@rh74 admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 08-APR-2016 19:33:50 Copyright (c) 1991, 2011, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rh74)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production Start Date 08-APR-2016 19:32:48 Uptime 0 days 0 hr. 1 min. 2 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/rh74/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rh74.cuug.cn)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Services Summary... Service "test1" has 1 instance(s). Instance "test1", status READY, has 1 handler(s) for this service... The command completed successfully
測試網(wǎng)絡(luò)連接:
[oracle@rh74 admin]$ sqlplus system/oracle@test1
SQL*Plus: Release 11.2.0.3.0 Production on Fri Apr 8 19:34:27 2016 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
19:34:27 SYSTEM@ test1>
----- 至此,手工建庫成功;如果有時(shí)間,可以對數(shù)據(jù)庫做一個(gè)冷備 。
---------- OCM考試考點(diǎn)練習(xí),后續(xù)繼續(xù)推出。。。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。