Centos6.0 Oracle11gR2 靜默命令列安裝[轉]
1 安裝前環境:
作業系統:CetnOS6.2x64 最小化安裝,已配置好網路IP:172.16.2.182,實體記憶體8GB,硬碟100GB。
已下載: linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
位於目錄/opt/
2 準備工作
root使用者登入後
#yum install vim //個人喜好vim編輯各種配置檔案,所以先下一個
#yum install unzip //下載unzip,用來解壓上述兩個壓縮檔案
#cd /opt //切換當前目錄到oracle壓縮檔案所在目錄
#unzip linux.x64_11gR2_database_1of2.zip //解壓
#unzip linux.x64_11gR2_database_2of2.zip
解壓後新增一個/opt/database目錄,裡面是解壓後的所有oracle安裝檔案。
在/etc/hosts檔案中增加主機名(通過hostname獲得)到迴環IP的對映如下:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 oracle11gcentos6.dlxg.gov.cn
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 oracle11gcentos6.dlxg.gov.cn
#vim /etc/selinux/conf 設定 SELINUX=disabled
#setenforce 0 //關閉selinux
#service iptables stop //臨時關閉防火牆
3 安裝必須的包
#yum install gcc
#yum install make
#yum install binutils
#yum install gcc-c++
#yum install compat-libstdc++-33
#yum install elfutils-libelf-devel
#yum install elfutils-libelf-devel-static
#yum install ksh
#yum install libaio
#yum install libaio-devel
#yum install numactl-devel
#yum install sysstat
#yum install unixODBC
#yum install unixODBC-devel
#yum install pcre-devel
4 準備安裝使用者及使用者組
#groupadd oinstall
#groupadd dba
#useradd -g oinstall -G dba -d /home/oracle oracle
#passwd oracle //設定oracle密碼
5 修改核心引數配置檔案
#vim /etc/sysctl.conf 在檔案最後增加
fs.aio-max-nr = 1048576
fs.file-max = 6553600
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
儲存檔案。
#/sbin/sysctl -p //讓引數生效
6 修改使用者的限制檔案
#vim /etc/security/limits.conf 在檔案後增加
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
儲存檔案。
修改/etc/pam.d/login檔案,增加如下:
session required /lib64/security/pam_limits.so //64為系統,千萬別寫成/lib/security/pam_limits.so,否則導致無法登入
session required pam_limits.so
修改/etc/profile,增加:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
7 建立安裝目錄和設定檔案許可權
#mkdir /opt/oracle
#mkdir /opt/oracle/11.2.0 //資料庫系統安裝目錄
#mkdir /opt/oradata //資料庫資料安裝目錄
#mkdir /opt/oradata_back //資料備份目錄
#mkdir /home/oracle/inventory //清單目錄
#chown -R oracle:oinstall /opt/oracle
#chown -R oracle:oinstall /home/oracle/inventory
#chomod -R 775 /opt/oracle
8 編輯靜默安裝響應檔案
#su - oracle
$cp -R /opt/database/response /home/oracle //複製一份模板
$cd /home/oracle
$mv db_install.rsp db_install_swonly.rsp //因為下面的安裝是隻安裝軟體不安裝啟動資料庫例項,所以改個名字以提示自己
$vim db_install_swonly.rsp //開始修改這個安裝響應檔案
需要設定的選項如下:
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 //系統生成的,不要修改
oracle.install.option=INSTALL_DB_SWONLY //只安裝軟體,不安裝啟動資料庫
ORACLE_HOSTNAME=oracle11gcentos6.dlxg.gov.cn //通過hostname命令獲得
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/home/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/opt/oracle/11.2.0
ORACLE_BASE=/opt/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.customComponents=oracle.server:11.2.0.1.0, //保持系統預設值
oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,
oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,
oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,
oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,
oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,
oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true //一定要設定為true
9 根據響應檔案安裝oracle
$cd /opt/database
$./runInstaller -silent -responseFile /home/oracle/response/db_install_swonly.rsp
安裝過程中,如果提示[WARNING]不必理會,此時安裝程式仍在進行,如果出現[FATAL],則安裝程式已經停止了。開啟另一個終端,執行
#tail -100f /home/oracle/inventory/logs/installActions......log
可以實時跟蹤檢視安裝日誌,瞭解安裝的進度。
當出現
以下配置指令碼需要以 "root" 使用者的身份執行。
#!/bin/sh
#要執行的 Root 指令碼
/home/oracle/inventory/orainstRoot.sh
/opt/oracle/11.2.0/root.sh
要執行配置指令碼, 請執行以下操作:
1. 開啟一個終端視窗
2. 以 "root" 身份登入
3. 執行指令碼
4. 返回此視窗並按 "Enter" 鍵繼續
Successfully Setup Software.
表示安裝成功了。按照其提示操作。
$exit //退回到root
#/home/oracle/inventory/orainstRoot.sh
#/opt/oracle/11.2.0/root.sh
10 編輯靜默建庫響應檔案
$cd /home/oracle
$mv dbca.rsp dbca_hello.rsp //改名為dbca_資料庫名.rsp
11 靜默配置監聽
$netca /silent /responsefile /home/oracle/response/netca.rsp
正在對命令列引數進行語法分析:
引數"silent" = true
引數"responsefile" = /home/oracle/response/netca.rsp
完成對命令列引數進行語法分析。
Oracle Net Services 配置:
完成概要檔案配置。
Oracle Net 監聽程式啟動:
正在執行監聽程式控制:
/opt/oracle/11.2.0/bin/lsnrctl start LISTENER
監聽程式控制完成。
監聽程式已成功啟動。
監聽程式配置完成。
成功完成 Oracle Net Services 配置。退出程式碼是0
成功執行後,在/opt/oracle/11.2.0/network/admin目錄下生成sqlnet.ora和listener.ora兩個檔案。
通過netstat -tlnp 命令,看到
tcp 0 0 :::1521 :::* LISTEN 5477/tnslsnr
說明監聽器已經在1521埠上開始工作了。
12 靜默建立新庫(同時也建立一個對應的例項)
修改/home/oracle/response/dbca.rsp,設定如下:
RESPONSEFILE_VERSION = "11.2.0" //不能更改
OPERATION_TYPE = "createDatabase"
GDBNAME = "hello.dlxg.gov.cn" //資料庫的名字
SID = "hello" //對應的例項名字
TEMPLATENAME = "General_Purpose.dbc" //建庫用的模板檔案
SYSPASSWORD = "gnotsms" //SYS管理員密碼
SYSTEMPASSWORD = "gnotsms" //SYSTEM管理員密碼
DATAFILEDESTINATION = /opt/oracle/oradata //資料檔案存放目錄
RECOVERYAREADESTINATION=/opt/oracle/oradata_back //恢復資料存放目錄
CHARACTERSET = "ZHS16GBK" //字符集,重要!!! 建庫後一般不能更改,所以建庫前要確定清楚。
TOTALMEMORY = "5120" //oracle記憶體5120MB
靜默建庫命令如下
$dbca -silent -responseFile /home/oracle/response/dbca.rsp
複製資料庫檔案
1% 已完成
3% 已完成
11% 已完成
18% 已完成
26% 已完成
37% 已完成
正在建立並啟動 Oracle 例項
40% 已完成
45% 已完成
50% 已完成
55% 已完成
56% 已完成
60% 已完成
62% 已完成
正在進行資料庫建立
66% 已完成
70% 已完成
73% 已完成
85% 已完成
96% 已完成
100% 已完成
有關詳細資訊, 請參閱日誌檔案 "/opt/oracle/cfgtoollogs/dbca/hello/hello.log"。
檢視日誌檔案
$ cat /opt/oracle/cfgtoollogs/dbca/hello/hello.log
複製資料庫檔案
DBCA_PROGRESS : 1%
DBCA_PROGRESS : 3%
DBCA_PROGRESS : 11%
DBCA_PROGRESS : 18%
DBCA_PROGRESS : 26%
DBCA_PROGRESS : 37%
正在建立並啟動 Oracle 例項
DBCA_PROGRESS : 40%
DBCA_PROGRESS : 45%
DBCA_PROGRESS : 50%
DBCA_PROGRESS : 55%
DBCA_PROGRESS : 56%
DBCA_PROGRESS : 60%
DBCA_PROGRESS : 62%
正在進行資料庫建立
DBCA_PROGRESS : 66%
DBCA_PROGRESS : 70%
DBCA_PROGRESS : 73%
DBCA_PROGRESS : 85%
DBCA_PROGRESS : 96%
DBCA_PROGRESS : 100%
資料庫建立完成。有關詳細資訊, 請檢視以下位置的日誌檔案:
/opt/oracle/cfgtoollogs/dbca/hello。
資料庫資訊:
全域性資料庫名:hello.dlxg.gov.cn
系統識別符號 (SID):hello
建庫後例項檢查:
$ ps -ef | grep ora_ | grep -v grep | wc -l
21
$ ps -ef | grep ora_ | grep -v grep
oracle 5955 1 0 07:03 ? 00:00:00 ora_pmon_hello
oracle 5957 1 0 07:03 ? 00:00:00 ora_vktm_hello
oracle 5961 1 0 07:03 ? 00:00:00 ora_gen0_hello
oracle 5963 1 0 07:03 ? 00:00:00 ora_diag_hello
oracle 5965 1 0 07:03 ? 00:00:00 ora_dbrm_hello
oracle 5967 1 0 07:03 ? 00:00:00 ora_psp0_hello
oracle 5969 1 0 07:03 ? 00:00:00 ora_dia0_hello
oracle 5971 1 0 07:03 ? 00:00:00 ora_mman_hello
oracle 5973 1 0 07:03 ? 00:00:00 ora_dbw0_hello
oracle 5975 1 0 07:03 ? 00:00:00 ora_lgwr_hello
oracle 5977 1 0 07:03 ? 00:00:00 ora_ckpt_hello
oracle 5979 1 0 07:03 ? 00:00:00 ora_smon_hello
oracle 5981 1 0 07:03 ? 00:00:00 ora_reco_hello
oracle 5983 1 0 07:03 ? 00:00:00 ora_mmon_hello
oracle 5985 1 0 07:03 ? 00:00:00 ora_mmnl_hello
oracle 5987 1 0 07:03 ? 00:00:00 ora_d000_hello
oracle 5989 1 0 07:03 ? 00:00:00 ora_s000_hello
oracle 5999 1 0 07:03 ? 00:00:00 ora_qmnc_hello
oracle 6020 1 0 07:03 ? 00:00:00 ora_cjq0_hello
oracle 6022 1 0 07:04 ? 00:00:00 ora_q000_hello
oracle 6024 1 0 07:04 ? 00:00:00 ora_q001_hello
檢視監聽狀態
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-MAR-2012 07:09:03
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 14-MAR-2012 06:16:50
Uptime 0 days 0 hr. 52 min. 15 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/11.2.0/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/oracle11gcentos6/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Services Summary...
Service "hello.dlxg.gov.cn" has 1 instance(s).
Instance "hello", status READY, has 1 handler(s) for this service...
Service "helloXDB.dlxg.gov.cn" has 1 instance(s).
Instance "hello", status READY, has 1 handler(s) for this service...
The command completed successfully
13 修改資料庫為歸檔模式(歸檔模式才能熱備份,增量備份)
$ export ORACLE_SID=hello
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 14 07:18:16 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 402655344 bytes
Database Buffers 1191182336 bytes
Redo Buffers 7360512 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database flashback on;
Database altered.
SQL> alter database open;
Database altered.
SQL> execute utl_recomp.recomp_serial();
PL/SQL procedure successfully completed.
SQL> alter system archive log current;
System altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
14 修改oracle啟動配置檔案
$vim /etc/oratab
hello:/opt/oracle/11.2.0:Y
這樣就可以通過dbstart 啟動此例項,也可以通過dbshut關閉此例項了。
$ dbshut /opt/oracle/11.2.0/
Processing Database instance "hello": log file /opt/oracle/11.2.0/shutdown.log
此時所有oracle的程序關閉,監聽器也停止。
$dbstart /opt/oracle/11.2.0/
Processing Database instance "hello": log file /opt/oracle/11.2.0/startup.log
此時監聽器工作,hello例項執行,再次檢視監聽器狀態。
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-MAR-2012 07:35:52
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 14-MAR-2012 07:35:38
Uptime 0 days 0 hr. 0 min. 13 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/11.2.0/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/oracle11gcentos6/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Services Summary...
Service "hello.dlxg.gov.cn" has 1 instance(s).
Instance "hello", status READY, has 1 handler(s) for this service...
Service "helloXDB.dlxg.gov.cn" has 1 instance(s).
Instance "hello", status READY, has 1 handler(s) for this service...
The command completed successfully
15 建立表空間及使用者
$export ORACLE_SID=hello; sqlplus / as sysdba
進入SQL>後
建立臨時表空間
create temporary tablespace user_temp tempfile '/opt/oracle/oradata/hello/user_temp.dbf' size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
建立資料表空間
create tablespace user_data
logging
datafile '/opt/oracle/oradata/hello/user_data.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
建立使用者並指定表空間
create user test identified by test
default tablespace user_data
temporary tablespace user_temp;
給使用者授予許可權
grant connect,resource to test;
此時在其他機器上可以遠端登入這個使用者,命令為:
$sqlplus test/[email protected]/hello.dlxg.gov.cn
16 用新建的使用者連線資料庫,並建立一個表
$ export NLS_LANG=American_America.AL32UTF8
注意:UTF8是為了使得sqlplus和linux終端環境一致起來,此時發往資料庫的是UTF8,資料庫儲存前會轉為ZHS16GBK.
當讀取時,Sqlplus會把收到的ZHS16GBK轉換為UTF8傳送到Linux終端。
$ sqlplus test/[email protected]/hello.dlxg.gov.cn
SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 14 08:22:11 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create table STUDENT(ID int, NAME varchar(20));
Table created.
SQL> insert into STUDENT values(1, '張三');
1 row created.
SQL> select * from student;
ID NAME
---------- ------------------------------------------------------------
1 張三
相關推薦
Centos6.0 Oracle11gR2 靜默命令列安裝[轉]
1 安裝前環境: 作業系統:CetnOS6.2x64 最小化安裝,已配置好網路IP:172.16.2.182,實體記憶體8GB,硬碟100GB。 已下載: linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
安裝Redhat Linux 9.0 後,在命令列下中文顯示為亂碼的解決方案
在安裝Redhat Linux 9.0時,如果安裝中選擇的預設語言為簡體中文,則在安裝後,在命令列中的許多命令的執行結果顯示為亂碼。而且用redhat_config_language命令也無法將系統預設語言修改為英文。 對這一問題,我們可以修改 /etc/sysconf
VMware Workstation 無介面linux系統(centos6.5),命令列安裝VMTools,並建立共享資料夾
1、VMware tools安裝 1.1 選中要安裝VMware tools的linux虛擬機器,然後點選VMware Workstation10頂部的“虛擬機器(M)”按鈕,選中“安裝VMware tools”按鈕,此時VMware tools的安裝包就會預設放在/de
redhat linux websphere 6 命令列安裝(靜默安裝)
WAS 6 命令列安裝(靜默安裝) 過去我們安裝was6 的時候,基本上都採用介面化安裝的方法,這種方法簡單方便。但是有時候,我們在安裝的時候伺服器沒有視窗,或者遠端安裝而無法連線視窗時,我們可以採用命令列安裝的方式,即靜默安裝。下面就介紹一下如何命令列安裝(靜默安裝--silent installati
ubuntu deb 安裝包的命令列安裝:
如果ubuntu要安裝新軟體,已有deb安裝包(例如:iptux.deb),但是無法登入到桌面環境。那該怎麼安裝?答案是:使用dpkg命令。 首先要使用 cd 命令到安裝包所在的檔案目錄,然後參考下面的命令進行操作: dpkg命令常用格式如下: sudo dpkg -I iptux.deb #檢
Ubuntu 18.04 下用命令列安裝Sublime
介紹: 新增來源: $ wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add - $ sudo apt-add-repository "deb https://download.sublime
命令列安裝MySQL——操作整理
初始化 D:\mysql-5.7.18-win32\bin\mysqld --initialize 安裝服務 D:\mysql-5.7.18-win32\bin\mysqld -install MySQL57 --defaults-file="D:\mysql-5.7.18-
Linux命令列安裝Oracle12c
1.下載Oracle12c 2.配置主機名和IP的對映 3.Oracle安裝的先決條件 3.1手動設定 3.1.1配置核心引數 3.1.2限制oracle使用
命令列安裝MySQL
1.使用管理員許可權進入cmd介面。 2.進入MySQL安裝包資料夾bin路徑。 3.使用mysqld install命令安裝MySQL。 4.使用net start mysql命令安裝mysql。 5.使用 mysql -u (root 使用者名稱) -p (1234 密碼) 登陸。沒有密碼,就不寫
Centos7命令列安裝圖形使用者介面
轉載:https://blog.csdn.net/zhagzheguo/article/details/79433307 安裝了圖形使用者介面的話: 1. 檢視系統裡是否已經安裝了圖形使用者介面。 使用ctrl+alt+fx,x為1234,都試試,看看是否能切換為圖形使用者介面。 我
MacOS下命令列安裝神器brew
1、安裝brew: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 2、解除安裝brew: /usr/bin/ruby -e "$(curl -f
Linux命令列安裝配置Android SDK
一、下載安裝sdk-tools Android SDK官網:https://developer.android.com/studio/index.html wget https://dl.google.com/android/repository/sdk-tools-
Windows下命令列安裝MySQL
一、下載壓縮包 說明:在Windows下,安裝MySQL可以直接下載安裝包(下載地址:https://dev.mysql.com/downloads/installer/),然後直接按照安裝包的提示,安裝自己需要的功能。也可以直接下載zip壓縮包。該壓縮包僅僅包
Ubuntu 14.04下命令列安裝PostgreSQL 和配置遠端訪問
1:更新你的系統: sudo apt-get update && sudo apt-get upgrade 安裝PostgreSQL 2 :從Ubuntu軟體包儲存庫安裝PostgreSQL: sudo apt-get install postg
Vbox:命令列安裝增強工具
yum install kernel sources kernel-devel gcc -y #yum groupinstall "Development tools" #安裝gcc init 6 # 重啟 mount /dev/cdrom /media #mount /dev/dvd
windows下用命令列安裝composer
安裝前請務必確保已經正確安裝了 PHP。開啟命令列視窗並執行 php -v 檢視是否正確輸出版本號。 安裝好後,開啟PHP拓展,在php.ini中找到 ;extension=php_openssl.dll ;extension=p
mac常用軟體命令列安裝,慢慢整理中
Homebrew是以最簡單,最靈活的方式來安裝蘋果公司在MacOS中不包含的UNIX工具 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/ins
weblogic命令列安裝
➜ weblogic java -jar wls1036_generic.jar Unable to instantiate GUI, defaulting to console mode. Extracting 0%....................
Mac下命令列安裝指定版本的lua,然後c++,lua相互互動
1.lua下載地址 2.build lua檔案 /Users/jianan/Downloads/lua-5.3.3 make macosx 3.安裝 make macosx install 4
Mac 命令列安裝Chrome外掛
- (void)startInstallChromeExtension { NSURL *url = [[NSWorkspace sharedWorkspace] URLForApplicationWithBundleIdentifier:@"com.google.Chrome"]; if (