手動建立Oracle執行個體

來源:互聯網
上載者:User

標籤:efault   parameter   dba   oba   pen   db_name   init   var   default   

手工建庫步驟

Step 1: Specify an Instance Identifier (SID)(指定一個執行個體的標識符SID)
Step 2: Ensure That the Required Environment Variables Are Set(確認環境變數的設定)
Step 3: Choose a Database Administrator Authentication Method(決定資料庫管理員的認證方法)
Step 4: Create the Initialization Parameter File(建立初始化的參數檔案資訊)
Step 5: (Windows Only) Create an Instance
Step 6: Connect to the Instance(串連執行個體)
Step 7: Create a Server Parameter File(建立spfile)
Step 8: Start the Instance(啟動執行個體)
Step 9: Issue the CREATE DATABASE Statement(建立DATABASE的語句)
Step 10: Create Additional Tablespaces(建立額外的資料表空間)
Step 11: Run Scripts to Build Data Dictionary Views(運行指令碼建立資料庫字典視圖)
Step 12: (Optional) Run Scripts to Install Additional Options
Step 13: Back Up the Database.
Step 14: (Optional) Enable Automatic Instance Startup


Step 1: Specify an Instance Identifier (SID)(指定一個執行個體的標識符SID)
export ORACLE_SID=lenovo
echo $ORACLE_SID


mkdir -p /u01/app/oracle/admin/lenovo/adump
orapwd file="/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwLENOVO" password=oracle entries=30
Step 2: Ensure That the Required Environment Variables Are Set(確認環境變數的設定)
[[email protected] lenovo]$ mkdir datafile
[[email protected] lenovo]$ mkdir redolog
[[email protected] lenovo]$ pwd
/u01/app/oracle/oradata/lenovo
[[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

#Oracle Settings
export TMP=/tmp
export TMPDIR=/tmp
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=lenovo
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib:/usr/X11R6/lib/
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export LANG=C
umask 022


alias date=‘date +%Y-%m-%d%t%A%t%T ‘

Step 3: Choose a Database Administrator Authentication Method(決定資料庫管理員的認證方法)
[[email protected] bin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/bin
[[email protected] bin]$ orapwd file=orapwdlenovo password=oracle entries=30

Step 4: Create the Initialization Parameter File(建立初始化的參數檔案資訊)
[[email protected] dbs]$ cat initlenovo.ora
db_name=‘LENOVO‘
memory_target=808M
control_files = (‘/u01/app/oracle/oradata/lenovo/controlfile/control01.ctl‘)

Step 6: Connect to the Instance(串連執行個體)
[[email protected] dbs]$ echo $ORACLE_SID
lenovo
[[email protected] dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 1 19:28:17 2016

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.

SQL>

Step 7: Create a Server Parameter File(建立spfile)
SQL> create spfile from pfile=‘/u01/app/oracle/product/11.2.0/db_1/dbs/initlenovo.ora‘;

Step 8: Start the Instance(啟動執行個體)
SQL> startup nomount
ORACLE instance started.

Total System Global Area 843456512 bytes
Fixed Size 2257920 bytes
Variable Size 494930944 bytes
Database Buffers 343932928 bytes
Redo Buffers 2334720 bytes

Step 9: Issue the CREATE DATABASE Statement(建立DATABASE的語句)
create_db.sql

CREATE DATABASE lenovo
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 (‘/u01/app/oracle/oradata/lenovo/redolog/redo01a.log‘) SIZE 100M BLOCKSIZE 512,
GROUP 2 (‘/u01/app/oracle/oradata/lenovo/redolog/redo02a.log‘) SIZE 100M BLOCKSIZE 512,
GROUP 3 (‘/u01/app/oracle/oradata/lenovo/redolog/redo03a.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/lenovo/datafile/system01.dbf‘ SIZE 325M REUSE
SYSAUX DATAFILE ‘/u01/app/oracle/oradata/lenovo/datafile/sysaux01.dbf‘ SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE ‘/u01/app/oracle/oradata/lenovo/datafile/users01.dbf‘
SIZE 50M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE ‘/u01/app/oracle/oradata/lenovo/datafile/temp01.dbf‘
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE ‘/u01/app/oracle/oradata/lenovo/datafile/undotbs01.dbf‘
SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

SQL> @/home/oracle/create_db.sql

Database created.

Step 10: Create Additional Tablespaces(建立額外的資料表空間)
SQL>CREATE TABLESPACE zstest DATAFILE ‘/u01/app/oracle/oradata/lenovo/datafile/test01.dbf‘ SIZE 50M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
SQL> select open_mode from v$database;

OPEN_MODE
----------------------------------------
READ WRITE

Step 11: Run Scripts to Build Data Dictionary Views(運行指令碼建立資料庫字典視圖)
SYSDBA使用者執行如下指令碼
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql

SYSTEM使用者執行如下指令碼
@?/sqlplus/admin/pupbld.sql

 

手動建立Oracle執行個體

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.