手工建庫(kù)步驟
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛(ài)。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶,將通過(guò)不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名注冊(cè)、虛擬主機(jī)、營(yíng)銷(xiāo)軟件、網(wǎng)站建設(shè)、西山網(wǎng)站維護(hù)、網(wǎng)站推廣。
Step 1: Specify an Instance Identifier (SID)(指定一個(gè)實(shí)例的標(biāo)識(shí)符SID)Step 2: Ensure That the Required Environment Variables Are Set(確認(rèn)環(huán)境變量的設(shè)置)Step 3: Choose a Database Administrator Authentication Method(決定數(shù)據(jù)庫(kù)管理員的認(rèn)證方法)Step 4: Create the Initialization Parameter File(創(chuàng)建初始化的參數(shù)文件信息)Step 5: (Windows Only) Create an InstanceStep 6: Connect to the Instance(連接實(shí)例)Step 7: Create a Server Parameter File(創(chuàng)建spfile)Step 8: Start the Instance(啟動(dòng)實(shí)例)
Step 9: Issue the CREATE DATABASE Statement(創(chuàng)建DATABASE的語(yǔ)句)Step 10: Create Additional Tablespaces(創(chuàng)建額外的表空間)Step 11: Run Scripts to Build Data Dictionary Views(運(yùn)行腳本創(chuàng)建數(shù)據(jù)庫(kù)字典視圖)Step 12: (Optional) Run Scripts to Install Additional OptionsStep 13: Back Up the Database.
Step 14: (Optional) Enable Automatic Instance StartupStep 1: Specify an Instance Identifier (SID)(指定一個(gè)實(shí)例的標(biāo)識(shí)符SID)export ORACLE_SID=lenovo
echo $ORACLE_SID
mkdir -p /u01/app/oracle/admin/lenovo/adumporapwd file="/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwLENOVO" password=oracle entries=30Step 2: Ensure That the Required Environment Variables Are Set(確認(rèn)環(huán)境變量的設(shè)置)[oracle@redhat3 lenovo]$ mkdir datafile
[oracle@redhat3 lenovo]$ mkdir redolog
[oracle@redhat3 lenovo]$ pwd
/u01/app/oracle/oradata/lenovo
[oracle@redhat3 ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programsPATH=$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_1export 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/jlibexport NLS_LANG=AMERICAN_AMERICA.ZHS16GBKexport LANG=C
umask 022
alias date='date +%Y-%m-%d%t%A%t%T '
Step 3: Choose a Database Administrator Authentication Method(決定數(shù)據(jù)庫(kù)管理員的認(rèn)證方法)[oracle@redhat3 bin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/bin
[oracle@redhat3 bin]$ orapwd file=orapwdlenovo password=oracle entries=30Step 4: Create the Initialization Parameter File(創(chuàng)建初始化的參數(shù)文件信息)[oracle@redhat3 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(連接實(shí)例)[oracle@redhat3 dbs]$ echo $ORACLE_SID
lenovo
[oracle@redhat3 dbs]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 1 19:28:17 2016Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL
Step 7: Create a Server Parameter File(創(chuàng)建spfile)SQL create spfile from pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initlenovo.ora';Step 8: Start the Instance(啟動(dòng)實(shí)例)
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(創(chuàng)建DATABASE的語(yǔ)句)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 512MAXLOGFILES 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 REUSESYSAUX DATAFILE '/u01/app/oracle/oradata/lenovo/datafile/sysaux01.dbf' SIZE 325M REUSEDEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/lenovo/datafile/users01.dbf'
SIZE 50M REUSE AUTOEXTEND ON MAXSIZE UNLIMITEDDEFAULT 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(創(chuàng)建額外的表空間)SQLCREATE 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(運(yùn)行腳本創(chuàng)建數(shù)據(jù)庫(kù)字典視圖)SYSDBA用戶執(zhí)行如下腳本
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql
SYSTEM用戶執(zhí)行如下腳本
@?/sqlplus/admin/pupbld.sql
第一步:輸入用戶名和密碼第二步:輸入數(shù)據(jù)庫(kù)”ip:152/實(shí)例“如”192.168.8.58:1521/orcl“,解釋前面的ip是oracle服務(wù)端安裝位置,1521是oracle默認(rèn)端口,orcl是創(chuàng)建數(shù)據(jù)庫(kù)的實(shí)例(默認(rèn)為orcl)
第三步:選擇連接方式為”Normal“,之后點(diǎn)擊確定,即可完成連接操作。
需要一些前提條件:
1、對(duì)方的主機(jī)能被連接(如在同一局域網(wǎng)內(nèi))
2、需要知道對(duì)方數(shù)據(jù)庫(kù)IP、端口號(hào)、服務(wù)名
3、需要知道對(duì)方提供的管理數(shù)據(jù)庫(kù)的用戶名及密碼
連接方法:
1、在本地的oracle安裝目錄,找到tnsnames.ora文件,一般在~\oracle\product\10.2.0\db_1\network\ADMIN目錄下,如圖:
2、用文本打開(kāi)tnsnames.ora文件,添加以下內(nèi)容:
本地自定義實(shí)例名?=
(DESCRIPTION?=
(ADDRESS?=?(PROTOCOL?=?TCP)(HOST?=?數(shù)據(jù)庫(kù)IP或數(shù)據(jù)庫(kù)主機(jī)名)(PORT?=?數(shù)據(jù)庫(kù)端口號(hào)))
(CONNECT_DATA?=
(SERVER?=?DEDICATED)
(SERVICE_NAME?=?數(shù)據(jù)庫(kù)服務(wù)名)
)
)
3、保存文件即可。
4、打開(kāi)第三方工具,如plsq,輸入對(duì)方提供的用戶名及密碼,選擇新建的數(shù)據(jù)庫(kù)鏈接即可。
前提是電腦必須安裝oracle客戶端。
配置方法:
1、找到oracle的安裝目錄。如:C:\oracle\product\10.2.0\db_1\network\ADMIN
2、找到tnsnames.ora文件。
3、用文本方式打開(kāi),添加以下內(nèi)容:
本地實(shí)例名?=
(DESCRIPTION?=
(ADDRESS?=?(PROTOCOL?=?TCP)(HOST?=?遠(yuǎn)程數(shù)據(jù)庫(kù)IP地址)(PORT?=?遠(yuǎn)程服務(wù)器端口號(hào)))
(CONNECT_DATA?=
(SERVER?=?DEDICATED)
(SERVICE_NAME?=?遠(yuǎn)程數(shù)據(jù)庫(kù)服務(wù)名)
)
)
其中中文部分是需要修改的部分,除第一個(gè)“本地實(shí)例名”外,其他需要跟遠(yuǎn)程數(shù)據(jù)庫(kù)管理員咨詢,本地實(shí)例名就是方便自己識(shí)別數(shù)據(jù)庫(kù)的一個(gè)名字,可以自定義。
4、然后打開(kāi)pl/sql就能看到自己創(chuàng)建的鏈接,如圖:
1、首先參數(shù)INSTANCE_TYPE對(duì)于ASM實(shí)例具有ASM的值,對(duì)于oracle實(shí)例默認(rèn)值為RDBMS。
2、參數(shù)DB_UNIQUE_NAME默認(rèn)值是ASM,是ASM實(shí)例唯一名稱。
3、參數(shù)ASM_DISKGROUPS參數(shù),指定一個(gè)包含磁盤(pán)組名稱的列表。
4、參數(shù)ASM_DISKSTRING指定一個(gè)或多個(gè)字符串,對(duì)于創(chuàng)建磁盤(pán)組的磁盤(pán)設(shè)備。
5、最后參數(shù)ASM_PREFERRED_READ_FAILURE_GROUPS是一個(gè)故障組列表,如下圖。