手動建立資料庫過程
1、設定環境變數:
[oracle@enmo ~]$ cat .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=PROD
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
編輯後,使其生效:
. .bash_profile
2、建立密碼檔案(作用:允許遠端用密碼方式以sysdba身份登陸資料庫,可有可無):
[oracle@enmo ~]$ cd $ORACLE_HOME/dbs
[oracle@enmo dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[oracle@enmo dbs]$ ls
init.ora init.ora.bck
3、生成密碼檔案:
[oracle@enmo dbs]$ orapwd file=orapwPROD password=oracle
[oracle@enmo dbs]$ ls
init.ora init.ora.bck orapwPROD
[oracle@enmo dbs]$
4、生成pfile檔案:
[oracle@enmo dbs]$ cat init.ora |grep -v ^#|grep -v ^$ > initPROD.ora
[oracle@enmo dbs]$ ls
init.ora init.ora.bck initPROD.ora orapwPROD
5、修改pfile檔案:
[oracle@enmo dbs]$ vi initPROD.ora
db_name='PROD'
memory_target=800M
processes = 150
audit_file_dest='/u01/app/oracle/admin/prod/adump'
#audit_trail ='db'
db_block_size=8192
db_domain='oracle.com'
#db_recovery_file_dest='/flash_recovery_area'
#db_recovery_file_dest_size=2G
#diagnostic_dest=''
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = (/u01/app/oracle/oradata/PROD/ora_control1.ctl,/u01/app/oracle/oradata/PROD/ora_control2.ctl)
compatible ='11.2.0'
6、根據pfile建立目錄adump目錄和控制檔案目錄:
[oracle@enmo ~]$ mkdir -p $ORACLE_BASE/admin/prod/adump
[oracle@enmo ~]$ mkdir -p $ORACLE_BASE/oradata/PROD/
7、透過pfile建立spfile:
[oracle@enmo dbs]$ ls
init.ora init.ora.bck initPROD.ora orapwPROD
[oracle@enmo dbs]$ echo $ORACLE_SID
PROD
[oracle@enmo dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Oct 5 23:29:53 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> !ls
init.ora init.ora.bck initPROD.ora orapwPROD spfilePROD.ora
8、資料庫啟動到nomount(預設情況下,oracle會使用spfile啟動資料庫):
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2257840 bytes
Variable Size 541068368 bytes
Database Buffers 289406976 bytes
Redo Buffers 2371584 bytes
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0
/dbhome_1/dbs/spfilePROD.ora
SQL> select status from v$instance;
STATUS
------------
STARTED
9、手工建庫指令碼:
create database prod
user sys identified by oracle
user system identified by oracle
logfile group 1('/u01/app/oracle/oradata/PROD/redo01.log') size 10M blocksize 512,
group 2('/u01/app/oracle/oradata/PROD/redo02.log') size 10M blocksize 512,
group 3('/u01/app/oracle/oradata/PROD/redo03.log') size 10M blocksize 512
maxlogfiles 5
maxlogmembers 5
maxloghistory 1
maxdatafiles 100
character set US7ASCII
national character set AL16UTF16
extent management local
datafile '/u01/app/oracle/oradata/PROD/system01.dbf' size 325M reuse
sysaux datafile '/u01/app/oracle/oradata/PROD/sysaux01.dbf' size 325M reuse
default tablespace users
datafile '/u01/app/oracle/oradata/PROD/users01.dbf'
size 50M reuse AUTOEXTEND ON MAXSIZE UNLIMITED
default temporary tablespace tempts1
tempfile '/u01/app/oracle/oradata/PROD/temp01.dbf' size 20M reuse
UNDO TABLESPACE UNDOTBS1
datafile '/u01/app/oracle/oradata/PROD/undotbs01.dbf'
size 50M reuse AUTOEXTEND ON MAXSIZE UNLIMITED;
10、檢視資料庫例項狀態:
SQL> select status from v$instance;
STATUS
------------
OPEN
11、檢視相關引數:
SQL> show parameter control_files
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string /u01/app/oracle/oradata/PROD/o
ra_control1.ctl, /u01/app/orac
le/oradata/PROD/ora_control2.c
tl
SQL> show parameter undo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS1
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0
/dbhome_1/dbs/spfilePROD.ora
SQL>
12、建立字典表及工具包:
--必執行指令碼
SQL> conn / as sysdba
SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
SQL> conn system/passwd
SQL> @?/sqlplus/admin/pupbld.sql
--可選指令碼
SQL> conn / as sysdba
SQL> @?/rdbms/admin/catblock.sql
SQL> @?/rdbms/admin/catoctk.sql
SQL> @?/rdbms/admin/owminst.plb
執行完以上的指令碼,手動建庫就完成了。手動建庫沒有hr與scott示例兩個使用者。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31392094/viewspace-2125862/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用AnalyticDB MySQL建立資料庫及表過程MySql資料庫
- mongodb怎麼手動建立資料庫MongoDB資料庫
- openGauss核心分析(九):資料庫表的建立過程資料庫
- 【資料庫】資料庫儲存過程(一)資料庫儲存過程
- openGauss核心分析(十):資料庫搜尋引的建立過程資料庫
- 資料庫恢復過程資料庫
- 資料庫儲存過程資料庫儲存過程
- 恢復MySQL資料庫建立儲存過程是遇到錯誤MySql資料庫儲存過程
- 2.3 通過DBCA建立資料庫資料庫
- 資料庫的連線過程資料庫
- MySql資料庫——儲存過程MySql資料庫儲存過程
- Oracle資料庫啟動過程及狀態詳解Oracle資料庫
- 【資料庫資料恢復】透過資料頁恢復Sql Server資料庫資料的過程資料庫資料恢復SQLServer
- Mysql資料庫建立儲存過程實現往資料表中新增欄位的方法MySql資料庫儲存過程
- 達夢資料庫資料檔案遷移過程資料庫
- 建立資料庫資料庫
- Tigase手動安裝過程
- 【資料庫資料恢復】透過恢復NDF檔案修復資料庫的資料恢復過程資料庫資料恢復
- Oracle資料庫SQL語句執行過程Oracle資料庫SQL
- 【資料庫資料恢復】Sql Server資料庫檔案丟失的資料恢復過程資料庫資料恢復SQLServer
- 伺服器斷電Oracle資料庫修復資料過程伺服器Oracle資料庫
- 建立資料庫表資料庫
- Mysql建立資料庫MySql資料庫
- 能否通過Enterprise Console建立目錄資料庫PW資料庫
- 資料庫欄位設定非空, phalcon建立資料驗證不透過資料庫
- 神通資料庫測試環境調優過程資料庫
- SQLServer2012x64資料庫 安裝過程SQLServer資料庫
- SQL Server 2016資料庫快照代理過程詳解SQLServer資料庫
- 頭歌資料庫實驗六:儲存過程資料庫儲存過程
- sqlserver資料庫還原儲存過程指令碼SQLServer資料庫儲存過程指令碼
- 自己動手寫Android資料庫框架Android資料庫框架
- SAP Query建立過程
- [JVM]物件建立過程JVM物件
- 通過EFCore呼叫GBase8s資料庫儲存過程資料庫儲存過程
- MySQL手動資料校驗+雲資料庫資料校驗MySql資料庫
- XamarinSQLite教程建立資料庫aSQLite資料庫
- 建立資料mysql庫流程MySql
- 小黑框建立資料庫資料庫
- 資料庫 建立 3表資料庫