您好,登錄后才能下訂單哦!
這篇文章給大家介紹oracle 11g如何進行手工建庫,內容非常詳細,感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。
工作環境: ORE 6.5
手工建庫是作為dba必須掌握的一個基本技能,它使清楚的認識oracle的目錄結構、oracle所必需的文件、理解表空間、認證方式等概念。
1.設置環境變量
[oracle@ENMOEDU ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=ENMOEDU
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/libi
~
~
~
~
".bash_profile" [readonly] 19L, 385C 1,1 All
[oracle@ENMOEDU ~]$ source .bash_profile
2.準備密碼文件及初始化參數文件和創建數據庫腳本
[oracle@ENMOEDU ~]$ cd $ORACLE_BASE
[oracle@ENMOEDU oracle]$ ls
cfgtoollogs checkpoints diag product
[oracle@ENMOEDU oracle]$ cd $ORACLE_HOME/dbs
[oracle@ENMOEDU dbs]$ ls
init.ora
[oracle@ENMOEDU dbs]$ orapwd file=orapwdENMOEDU password=oracle entries=30
[oracle@ENMOEDU dbs]$ cat init.ora|grep -v ^$|grep -v ^# >initENMOEDU.ora
[oracle@ENMOEDU dbs]$ vi initENMOEDU.ora
diagnostic_dest='/u01/app/oracle'
db_name='ENMOEDU'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/ENMOEDU/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = (/u01/app/oracle/oradata/ENMOEDU/control01.ctl,/u01/app/oracle/oradata/ENMOEDU/control02.ctl)
compatible ='11.2.0'
~
~
~
~
~
~
~
"initENMOEDU.ora" 15L, 493C written
3.準備創建數據庫需要的相關目錄
[oracle@ENMOEDU oracle]$ cd /u01/app/oracle/
[oracle@ENMOEDU oracle]$ mkdir -p admin/ENMOEDU/audmp
[oracle@ENMOEDU oracle]$ mkdir -p flash_recovery_area
[oracle@ENMOEDU oracle]$ ls
admin cfgtoollogs checkpoints diag flash_recovery_area product
4.開始手工建庫
[oracle@ENMOEDU ENMOEDU]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 10 00:39:10 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1071333376 bytes
Fixed Size 1349732 bytes
Variable Size 620758940 bytes
Database Buffers 444596224 bytes
Redo Buffers 4628480 bytes
[oracle@ENMOEDU ~]$ vi create_db.sql
CREATE DATABASE ENMOEDU
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/ENMOEDU/redo01a.log','/u01/app/oracle/oradata/ENMOEDU/redo01b.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u01/app/oracle/oradata/ENMOEDU/redo02a.log','/u01/app/oracle/oradata/ENMOEDU/redo02b.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/ENMOEDU/redo03a.log','/u01/app/oracle/oradata/ENMOEDU/redo03b.log') SIZE 100M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/ENMOEDU/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/u01/app/oracle/oradata/ENMOEDU/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/ENMOEDU/users01.dbf'
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/ENMOEDU/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/u01/app/oracle/oradata/ENMOEDU/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
"create_db.sql" 24L, 1237C written
[oracle@ENMOEDU ~]$ cd /u01/app/oracle
[oracle@ENMOEDU oracle]$ ls
admin cfgtoollogs checkpoints diag flash_recovery_area product
[oracle@ENMOEDU oracle]$ mkdir -p oradata/ENMOEDU
[oracle@ENMOEDU oracle]$ cd /u01/app/oracle/diag/rdbms/enmoedu/ENMOEDU/trace/
[oracle@ENMOEDU trace]$ tail -100f alert_ENMOEDU.log
SQL> @/home/oracle/create_db.sql
Database created.
SQL>@?/rdbms/admin/catalog.sql
......
PL/SQL procedure successfully completed.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP CATALOG 2014-02-10 01:12:14
SQL> @?/rdbms/admin/catproc.sql
......
SQL>
SQL> SELECT dbms_registry_sys.time_stamp('CATPROC') AS timestamp FROM DUAL;
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP CATPROC 2014-02-10 01:25:21
1 row selected.
SQL>
SQL> SET SERVEROUTPUT OFF
SQL>
SQL>
SQL> select status from v$instance;
STATUS
------------
OPEN
1 row selected.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ENMOEDU ENMOEDU]$
5.完成手工建庫
關于oracle 11g如何進行手工建庫就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。