手工建立ORACLE 11g 資料庫
我們可以使用DBCA建立資料庫,但是手工建庫也是DBA必須掌握的,學會了手工建庫有利於我們更好的瞭解oracle的體系結構。我們一起看一下手工建庫的步驟吧!
資料庫系統版本:11g
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
2)建立口令檔案
[oracle@ENMOEDU ~]$ cd $ORACLE_HOME/dbs
[oracle@ENMOEDU dbs]$ ls
init.ora
[oracle@ENMOEDU dbs]$ orapwd file=orapwENMOEDU password=oracle entries=30;
[oracle@ENMOEDU dbs]$ ls
init.ora orapwENMOEDU
3)修改已有的init.ora建立引數檔案 此資料庫的db_name=ENMOEDU
[oracle@ENMOEDU dbs]$ cat init.ora|grep -v ^$|grep -v ^# > initENMOEDU.ora
[oracle@ENMOEDU dbs]$ vi initENMOEDU.ora
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'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = ('/u01/app/oracle/oradata/ENMOEDU/control01.ctl', '/u01/app/oracle/oradata/ENMOEDU/control.ctl')
compatible ='11.2.0'
4)建立資料庫需要的資料夾
[oracle@ENMOEDU ~]$ mkdir -p /u01/app/oracle/admin/ENMOEDU/adump
[oracle@ENMOEDU ~]$ mkdir -p /u01/app/oracle/flash_recovery_area
[oracle@ENMOEDU ~]$ mkdir -p /u01/app/oracle/oradata/ENMOEDU
5)啟動資料庫到nomount
[oracle@ENMOEDU dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Feb 5 20:48:58 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
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
6)建立資料庫的一個指令碼(根據官方文件)
[oracle@ENMOEDU oracle]$ vi create_db.sql
CREATE DATABASE ENMOEDU
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/ENMOEDUredo01a.log','/u01/app/oracle/oradata/ENMOEDUredo01b.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u01/app/oracle/oradata/ENMOEDUredo02a.log','/u01/app/oracle/oradata/ENMOEDUredo02b.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/ENMOEDUredo03a.log','/u01/app/oracle/oradata/ENMOEDUredo03b.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;
7)執行指令碼建立資料庫
SQL> @/home/oracle/create_db.sql
Database created.
8)執行指令碼建立資料字典檢視
SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
9)檢視資料庫的狀態
SQL> select status from v$instance;
STATUS
------------
OPEN
1 row selected.
10)建立spfile檔案
SQL> create spfile from pfile;
File created.
手工建立資料庫就完成了。
總結:手工建庫的步驟為:設定環境變數;建立口令檔案;建立pfile檔案,建立必要的檔案目錄;建立資料庫,執行必要的指令碼;建立spfile檔案。
The end
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29435844/viewspace-1077375/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 2.4.10 Step 9:手工建立資料庫資料庫
- 11G oracle資料庫重新啟動crsOracle資料庫
- 靜默安裝Oracle資料庫11gOracle資料庫
- Oracle 11g用impdp還原資料庫Oracle資料庫
- Oracle 11G資料庫單例項安裝Oracle資料庫單例
- oracle資料庫建立資料庫例項-九五小龐Oracle資料庫
- oracle 11g 單例項資料庫的安裝Oracle單例資料庫
- oracle 11g建立基線詳細資訊Oracle
- 【AWR】Oracle資料庫建立awr基線Oracle資料庫
- oracle資料庫建立、刪除索引等操作Oracle資料庫索引
- oracle資料庫使用者建立步驟Oracle資料庫
- 揭祕Oracle雲(一):建立雲資料庫Oracle資料庫
- Oracle各種版本下“示例資料庫的建立”的建立Oracle資料庫
- 揭祕Oracle雲(二):建立自治雲資料庫Oracle資料庫
- Oracle Data Pump 11G 資料泵元件Oracle元件
- Oracle 11g 重新建立控制檔案Oracle
- Oracle 11g刪除庫重建Oracle
- 【BUILD_ORACLE】Oracle 19c RAC搭建(六)建立RAC資料庫UIOracle資料庫
- 確保Oracle 11g R2資料庫高可用性WQOracle資料庫
- oracle 10g建立資料庫鏈的簡化Oracle 10g資料庫
- Oracle獲取資料庫中的物件建立語句Oracle資料庫物件
- 建立資料庫資料庫
- Oracle 11g 052題庫解析1Oracle
- 多個資料庫是否可以共有一個Oracle 11g RAC例項KG資料庫Oracle
- oracle dg庫資料檔案建立失敗ORA-01111Oracle
- 使用免費的Oracle雲服務-建立ATP資料庫Oracle資料庫
- 靜默方式安裝、升級oracle(二): 建立資料庫Oracle資料庫
- Oracle同一臺伺服器建立多個資料庫Oracle伺服器資料庫
- 「Oracle」Oracle 資料庫安裝Oracle資料庫
- 達夢資料庫手工恢復相關命令資料庫
- 主備資料庫狀態手工比對(一)資料庫
- 主備資料庫狀態手工比對(二)資料庫
- oracle 11G RAC的建立(VM虛擬環境)Oracle
- 建立資料庫表資料庫
- Mysql建立資料庫MySql資料庫
- Oracle資料庫配置Oracle資料庫
- Oracle 11g impdp 先資料後索引匯入方法Oracle索引
- Oracle 11G DBMS_REDEFINITION修改表資料型別Oracle資料型別
- oracle資料庫與oracle例項Oracle資料庫