ORACLE 手工建庫
引數設計:
資料庫名
1:配置環境變數(以下是本實驗環境的配置)
[[email protected] ~]$ 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
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
[[email protected] ~]$
--使環境變數生效,當然,如果重新登陸或者做過切換等操作,此步驟可以省略
[[email protected] ~]$ . .bash_profile
[[email protected] ~]$
2:建立密碼檔案(作用:允許遠端用密碼方式以sysdba身份登陸資料庫,密碼檔案可有可無)
--切換到存放密碼檔案的目錄
[[email protected] ~]$ cd $ORACLE_HOME/dbs
[[email protected] dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[[email protected] dbs]$ ls
init.ora
[[email protected] dbs]$
--生成密碼檔案的命令,幫助資訊
[[email protected] dbs]$ orapwd
Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>
where
file - name of password file (required),
password - password for SYS will be prompted if not specified at command line,
entries - maximum number of distinct DBA (optional),
force - whether to overwrite existing file (optional),
ignorecase - passwords are case-insensitive (optional),
nosysdba - whether to shut out the SYSDBA logon (optional Database Vault only).
There must be no spaces around the equal-to (=) character.
[[email protected] dbs]$
--生成密碼檔案,密碼檔案的格式:orapw+SID
[[email protected] dbs]$ orapwd file=orapwPROD password=oracle
[[email protected] dbs]$ ls
init.ora orapwPROD
[[email protected] dbs]$
3:生成pfile檔案
[[email protected] dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[[email protected] dbs]$ ls
init.ora orapwPROD
[[email protected] dbs]$ cat init.ora |grep -v ^#|grep -v ^$ > initPROD.ora
[[email protected] dbs]$ ls
init.ora initPROD.ora orapwPROD
[[email protected] dbs]$
[[email protected] dbs]$ vi initPROD.ora
db_name='PROD'
memory_target=1G
processes = 150
--注意要校驗此路徑,在下一步建立目錄時,要相同
audit_file_dest='/u01/app/oracle/admin/prod/adump'
#audit_trail ='db'
--把審計的引數註釋掉,去掉這個功能,DBCA建庫,預設情況下是啟用的。db_block_size=8192
db_domain=''
--關閉快速恢復區
#db_recovery_file_dest='<ORACLE_BASE>/flash_recovery_area'
--關閉快速恢復區,如果需要開啟的話,隨時可以通過修改引數來完成。
#db_recovery_file_dest_size=2G
--註釋掉診斷的引數,資料庫建立好後,這個引數會自動啟用
#diagnostic_dest='<ORACLE_BASE>'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
--undo表空間名稱,在建立資料庫時名稱要匹配上
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'
4:根據pfile建立目錄adump目錄和控制檔案目錄
[[email protected] ~]$ mkdir -p $ORACLE_BASE/admin/prod/adump
[[email protected] ~]$ mkdir -p $ORACLE_BASE/oradata/PROD/
[[email protected] ~]$
5:通過pfile建立spfile
--檢視已存在的pfile檔案initPROD.ora
[[email protected] ~]$ cd $ORACLE_HOME/dbs
[[email protected] dbs]$ ls
init.ora initPROD.ora orapwPROD
[[email protected] dbs]$
--驗證當前環境變數
[[email protected] dbs]$ echo $ORACLE_SID
PROD
[[email protected] dbs]$
--通過pfile建立spfile
[[email protected] dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Feb 28 16:34:35 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> !ls
init.ora initPROD.ora orapwPROD spfilePROD.ora
SQL>
6:資料庫啟動到nomount(預設情況下,oracle會使用spfile啟動資料庫)
[[email protected] dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Feb 28 17:20:28 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 671089544 bytes
Database Buffers 390070272 bytes
Redo Buffers 5517312 bytes
SQL>
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ----------------------------------------------------------
spfile string /u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilePROD.ora
SQL>
SQL> select status from v$instance;
STATUS
------------
STARTED
SQL>
7:編寫建立資料庫指令碼
Oracle11g官方文件:
Administrator’s Guide->2 Creating and Configuring an Oracle Database->Step 9: Issue the CREATE DATABASE Statement
1)修改資料庫名稱及相關口令
2)由於是測試環境,所以,可以將日誌檔案改為1個成員,把成員大小改為10M
3)修改users表空間大小及undo表空間大小
4)修改undo表空間的名稱,要與pfile檔案中的名稱相同
CREATE DATABASE PROD
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/PROD/redo01a.log') SIZE 10M BLOCKSIZE 512,
GROUP 2 ('/u01/app/oracle/oradata/PROD/redo02a.log') SIZE 10M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/PROD/redo03a.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;
8:建立資料庫(資料庫此時的狀態應該是nomount,直接在sqlplus下執行建立資料庫指令碼即可)
SQL> CREATE DATABASE PROD
2 USER SYS IDENTIFIED BY oracle3 USER SYSTEM IDENTIFIED BY oracle
4 LOGFILE GROUP 1 ('/u01/app/oracle/oradata/PROD/redo01a.log') SIZE 10M BLOCKSIZE 512,
5 GROUP 2 ('/u01/app/oracle/oradata/PROD/redo02a.log') SIZE 10M BLOCKSIZE 512,
6 GROUP 3 ('/u01/app/oracle/oradata/PROD/redo03a.log') SIZE 10M BLOCKSIZE 512
7 MAXLOGFILES 5
8 MAXLOGMEMBERS 5
9 MAXLOGHISTORY 1
10 MAXDATAFILES 100
11 CHARACTER SET US7ASCII
12 NATIONAL CHARACTER SET AL16UTF16
13 EXTENT MANAGEMENT LOCAL
14 DATAFILE '/u01/app/oracle/oradata/PROD/system01.dbf' SIZE 325M REUSE
15 SYSAUX DATAFILE '/u01/app/oracle/oradata/PROD/sysaux01.dbf' SIZE 325M REUSE
16 DEFAULT TABLESPACE users
17 DATAFILE '/u01/app/oracle/oradata/PROD/users01.dbf'
18 SIZE 50M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
19 DEFAULT TEMPORARY TABLESPACE tempts1
20 TEMPFILE '/u01/app/oracle/oradata/PROD/temp01.dbf'
21 SIZE 20M REUSE
22 UNDO TABLESPACE UNDOTBS1
23 DATAFILE '/u01/app/oracle/oradata/PROD/undotbs01.dbf'
24 SIZE 50M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
Database created.
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL>
--檢視相關引數SQL> show parameter control_files
NAME TYPE VALUE
------------------- ----------- ------------------------------
control_files string /u01/app/oracle/oradata/PROD/ora_control1.ctl, /u01/app/oracle/oradata/PROD/ora_control2.ctl
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>
9:建立字典表及工具包
--必執行指令碼
SQL> conn / as sysdba
SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
SQL> conn system/oracle
SQL> @?/sqlplus/admin/pupbld.sql
--可選指令碼
SQL> conn / as sysdba
SQL> @?/rdbms/admin/catblock.sql
SQL> @?/rdbms/admin/catoctk.sqlSQL> @?/rdbms/admin/owminst.plb
相關推薦
Oracle手工建庫及配置監聽
一、關閉資料庫 二、修改SID [[email protected]~]$ vi .bash_profile exportORACLE_SID=powter 使其生效並驗證: [[email protected]~]$ source .bash_pr
oracle 手工建庫(筆記)
手工建立資料庫(prod):1.修改環境變數export ORACLE_SID=prod2.建立口令檔案orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID pas
linux下oracle 手工建庫
#1. 建立例項(linux下例項不需要服務所以不用建立,oradim–new –sid lmqq) #2.複製pfile cp /oracle/database/11g/dbs/init.ora /oracle/database/11g/dbs/initlmqq.ora
ORACLE 手工建庫
引數設計: 資料庫名 1:配置環境變數(以下是本實驗環境的配置) [[email protected] ~]$ cat .bash_profile # .bash_profile# Get the aliases and functionsif [ -f
oracle官方文件-手工建庫詳解
Creating a Database with the CREATE DATABASE Statement Using the CREATE DATBASE SQL statement is a more manual approach to creating a
Linux 安裝 Oracle 11g——手工建庫(RAC)
建立目錄mkdir -p /u01/app/oracle/admin/orcl/adump編輯引數檔案*.memory_target=512m*.audit_file_dest='/u01/ap
ORACLE 11G 手工建庫
原創作品,出自 “深藍的blog” 部落格,歡迎轉載,轉載時請務必註明以下出處,否則追究版權法律責任。 第一步:目錄 --資料庫檔案目錄 $ cd $ORACLE_BASE/oradata $
ORACLE 18C 建庫遭遇 ORA-12754報錯
18C安裝 ORA-12754 為了體驗一下ORACLE 18C,一大早就上https://edelivery.oracle.com/osdc/faces/SoftwareDelivery 把安裝介質弄了下來。 先測試了下數據庫軟件的安裝,按照官方安裝文檔裏面提供的yum安裝包配置方式沒有成功,yu
oracle 靜默建庫、建監聽
oracle靜默建庫經本人測試如果靜默建模版,在其它的數據庫服務器裏面調用需要拷到數據庫的絕對路徑,為了實施方便,這邊使用圖形化建模。建模版,CMD命令窗口輸入dbca 選擇需要建模的數據庫實例 需要用模版時拷貝三個到其它機器上 3.靜默建
oracle手工刪除庫
狀態 ole tro restrict 模式 以及 11g name lte 無法使用圖形界面時,我們需要手動刪除數據庫一、手動刪除文件系統數據庫 1.停止監聽,防止有新的連接產生,同時,在數據庫配置了em的,也需要停止 $ lsnrctl stop lis
Oracle資料庫-建庫、建表空間,建使用者
Oracle安裝完後,其中有一個預設的資料庫,除了這個預設的資料庫外,我們還可以建立自己的資料庫。 對於初學者來說,為了避免麻煩,可以用'Database Configuration Assistant'嚮導來建立資料庫。 建立完資料庫後,並不能立即在資
手工建庫後表空間資料檔案非自動擴充套件引起的錯誤:ORA-01653: unable to extend* in tablespace*
手工建庫時,未將表空間資料檔案設定為自動擴充套件引起的錯誤:ORA-01653: unable to extend * in tablespace * 的解決:檢視資料庫alert日誌檔案時,發現出現大量如下的錯誤: Sun Dec 01 10:00:42 2013 ORA
Oracle資料庫建庫
使用的Oracle資料庫,在命令列sql*plus上用管理員賬號登入,輸入以下命令: sqlplus / assysdba; 然後建立表空間和使用者並執行資料初始化指令碼,其步驟如下: 1) 表空間
Oracle11gR2手工建庫(附DBCA靜默建庫)
參考官方文件:E25494-03 環境:CentOS6.5 Oracle11.2.0.4 1. 指定Oracle SID [[email protected] ~]$ echo $ORACLE_SID orcl 2. 設定環境變數 [[email
oracle簡單建庫基本流程
建庫流程 1、 登入到252伺服器(我的伺服器地址是172.20.223.252): SSH 172.20.223.252 2、 切換到oracle資料庫下: su – oracle 3、 以sysdba許可權登入到oracle資料庫中:
一鍵安裝ORACLE並建庫指令碼
最近學shell,練習而寫,只貼了一部分,沒法直接用,但是可以作為例子吧 #!/bin/bash SETPASSWD(){ #set password expect -c " set timeout 2; sp
完全Oracle安裝建庫手冊
處理 同學 示例 文件夾 演示 orm 參數配置 靜默安裝 add Oracle12C R2 for Centos 7 背景介紹安裝配置這東西吧,真沒啥可寫的,但是你說不寫詳細點吧,真的好多學員搞不懂,所以呢,熊熊思前想後,打算把自己從頭到尾怎麽安裝的,完全寫一下,希望能讓
ORACLE 建庫過程總結
sel index auto 索引表 建表 arch 命名 需要 select 1,忘記sys密碼 打開CMD命令窗口,執行以下操作: 1,SQLPLUS /NOLOG; 2, 3,CONNECT / AS SYSDBA 4, 5,ALTER USER SYS ID
oracle 11g rac dbca建庫時提示創建監聽
oracle 監聽 listener oracle rac Oracle 11g rac dbca建庫時提示創建監聽在安裝oracle 11g rac時,使用dbca建庫的過程中提示需要創建監聽:Default Listener "LISTENER" is not configured in
怎樣手動創建oracle數據庫
from pro bsp 1.0 fixed root there cte process 以下的實驗室是怎樣不要通過DBCA創建ORACLE 數據庫,而是通過ORACLE ONLINE HELP DOCUMENT進行手動的創建數據庫的具體步驟: 1,編輯Oracle