【TAR】【安裝】Linux環境使用TAR命令快速部署安裝Oracle
使用tar命令可以實現快速部署和安裝Oracle的目的,當然,前提是您手中已經有了一份被您精心調優後的資料庫tar包,此後,您就可以使用解tar的方式在其他的伺服器上進行快速部署安裝了。
下面展現一下這個“快速”的過程(斟酌一下哪些步驟還可以簡化?)。
--------------------------------------------------------------------------------
1.安裝必須的系統包
[root@secDB Server]# cd /media/RHEL_5.3\ x86_64\ DVD/Server/
rpm -ivh setarch-2*
rpm -ivh make-3*
rpm -ivh glibc-2*
rpm -ivh libaio-0*
rpm -ivh compat-libstdc++-33-3*
rpm -ivh compat-gcc-34-3*
rpm -ivh compat-gcc-34-c++-3*
rpm -ivh libXp-1*
rpm -ivh openmotif-2*
rpm -ivh compat-db-4*
--------------------------------------------------------------------------------
2.修改sysctl.conf檔案並使用“sysctl -p”命令使之生效
# vi /etc/sysctl.conf
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
# /sbin/sysctl -p
--------------------------------------------------------------------------------
3.編輯limits.conf檔案,尾部新增下面的內容
# vi /etc/security/limits.conf
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
--------------------------------------------------------------------------------
4.編輯login檔案,新增一行內容
# vi /etc/pam.d/login
session required /lib/security/pam_limits.so
--------------------------------------------------------------------------------
5.修改config檔案
# vi /etc/selinux/config
SELINUX=disabled
#SELINUXTYPE=targeted(登出該行)
SELINUXTYPE=disabled
--------------------------------------------------------------------------------
6.此時,最好重啟一下伺服器。
--------------------------------------------------------------------------------
7.建立oracle使用者及組,並設定密碼
# groupadd oinstall
# groupadd dba
# groupadd oper
# useradd -m -g oinstall -G dba oracle
# passwd oracle
輸入密碼:oracle
--------------------------------------------------------------------------------
8.將tar包解開
這裡要注意的的地方是:確認之前生成tar包的路徑選用的是絕對路徑還是相對路徑,確保解tar後保持原有的目錄結構不變。
[root@secDB /]# tar -xvf oracle_10203_.tar
--------------------------------------------------------------------------------
9.su到oracle使用者,編輯.bash_profile配置檔案
# su - oracle
# vi ~/.bash_profile
內容為:
# .bash_profile
set -o vi
# 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=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=secooler
export ORACLE_TERM=xterm
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH:.
export PATH=$PATH:/usr/sbin:/sbin:$HOME/bin:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin:$ORACLE_BASE/common/oracle/bin:$ORACLE_HOME/bin:/oracle/crs/oracle/product/10.2.0/crs/bin:$ORA_CRS_HOME/bin
#LD_ASSUME_KERNEL=2.4.1; export LD_ASSUME_KERNEL
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
set -o vi
--------------------------------------------------------------------------------
10. 修改listener.ora檔案和tnsnames.ora檔案,將其中的IP地址替換為伺服器的具體IP資訊,並修改為靜態監聽(您也可以不使用靜態監聽的模式,以您具體測試結果為準)
scl@secDB /home/oracle$ cat $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
# listener.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = secooler)
(ORACLE_HOME = /oracle/app/oracle/product/10.2.0/db_1)
(SID_NAME = secooler)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 144.194.192.100)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
scl@secDB /home/oracle$ cat $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
secooler =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 144.194.192.100)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = secooler)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
--------------------------------------------------------------------------------
11.啟動監聽
scl@secDB /home/oracle$ lsnrctl start
--------------------------------------------------------------------------------
12.修改hosts檔案,將主機的名字新增到“127.0.0.1”後面,修改後的樣例如下
[root@secDB ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 secDB localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
--------------------------------------------------------------------------------
13.最後,啟動資料庫,並驗證資料庫的可用性
scl@secDB /home/oracle$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Wed Oct 21 14:41:21 2009
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 1577058304 bytes
Fixed Size 2073024 bytes
Variable Size 385879616 bytes
Database Buffers 1174405120 bytes
Redo Buffers 14700544 bytes
Database mounted.
Database opened.
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
SQL>
--------------------------------------------------------------------------------
14.小結
如果您經常在相同的作業系統環境下頻繁的部署和安裝小型的Oracle資料庫,可以考慮使用這個解tar的方法。這樣可以避免圖形化介面安裝過程的枯燥和乏味,同時可以節省DBA的寶貴時間。
這種方法也是快速構建測試環境的高效方法,可以真實的再現原有資料庫的細節。
Good luck.
-- The End --
下面展現一下這個“快速”的過程(斟酌一下哪些步驟還可以簡化?)。
--------------------------------------------------------------------------------
1.安裝必須的系統包
[root@secDB Server]# cd /media/RHEL_5.3\ x86_64\ DVD/Server/
rpm -ivh setarch-2*
rpm -ivh make-3*
rpm -ivh glibc-2*
rpm -ivh libaio-0*
rpm -ivh compat-libstdc++-33-3*
rpm -ivh compat-gcc-34-3*
rpm -ivh compat-gcc-34-c++-3*
rpm -ivh libXp-1*
rpm -ivh openmotif-2*
rpm -ivh compat-db-4*
--------------------------------------------------------------------------------
2.修改sysctl.conf檔案並使用“sysctl -p”命令使之生效
# vi /etc/sysctl.conf
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
# /sbin/sysctl -p
--------------------------------------------------------------------------------
3.編輯limits.conf檔案,尾部新增下面的內容
# vi /etc/security/limits.conf
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
--------------------------------------------------------------------------------
4.編輯login檔案,新增一行內容
# vi /etc/pam.d/login
session required /lib/security/pam_limits.so
--------------------------------------------------------------------------------
5.修改config檔案
# vi /etc/selinux/config
SELINUX=disabled
#SELINUXTYPE=targeted(登出該行)
SELINUXTYPE=disabled
--------------------------------------------------------------------------------
6.此時,最好重啟一下伺服器。
--------------------------------------------------------------------------------
7.建立oracle使用者及組,並設定密碼
# groupadd oinstall
# groupadd dba
# groupadd oper
# useradd -m -g oinstall -G dba oracle
# passwd oracle
輸入密碼:oracle
--------------------------------------------------------------------------------
8.將tar包解開
這裡要注意的的地方是:確認之前生成tar包的路徑選用的是絕對路徑還是相對路徑,確保解tar後保持原有的目錄結構不變。
[root@secDB /]# tar -xvf oracle_10203_.tar
--------------------------------------------------------------------------------
9.su到oracle使用者,編輯.bash_profile配置檔案
# su - oracle
# vi ~/.bash_profile
內容為:
# .bash_profile
set -o vi
# 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=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=secooler
export ORACLE_TERM=xterm
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH:.
export PATH=$PATH:/usr/sbin:/sbin:$HOME/bin:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin:$ORACLE_BASE/common/oracle/bin:$ORACLE_HOME/bin:/oracle/crs/oracle/product/10.2.0/crs/bin:$ORA_CRS_HOME/bin
#LD_ASSUME_KERNEL=2.4.1; export LD_ASSUME_KERNEL
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
set -o vi
--------------------------------------------------------------------------------
10. 修改listener.ora檔案和tnsnames.ora檔案,將其中的IP地址替換為伺服器的具體IP資訊,並修改為靜態監聽(您也可以不使用靜態監聽的模式,以您具體測試結果為準)
scl@secDB /home/oracle$ cat $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
# listener.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = secooler)
(ORACLE_HOME = /oracle/app/oracle/product/10.2.0/db_1)
(SID_NAME = secooler)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 144.194.192.100)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
scl@secDB /home/oracle$ cat $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
secooler =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 144.194.192.100)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = secooler)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
--------------------------------------------------------------------------------
11.啟動監聽
scl@secDB /home/oracle$ lsnrctl start
--------------------------------------------------------------------------------
12.修改hosts檔案,將主機的名字新增到“127.0.0.1”後面,修改後的樣例如下
[root@secDB ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 secDB localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
--------------------------------------------------------------------------------
13.最後,啟動資料庫,並驗證資料庫的可用性
scl@secDB /home/oracle$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Wed Oct 21 14:41:21 2009
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 1577058304 bytes
Fixed Size 2073024 bytes
Variable Size 385879616 bytes
Database Buffers 1174405120 bytes
Redo Buffers 14700544 bytes
Database mounted.
Database opened.
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
SQL>
--------------------------------------------------------------------------------
14.小結
如果您經常在相同的作業系統環境下頻繁的部署和安裝小型的Oracle資料庫,可以考慮使用這個解tar的方法。這樣可以避免圖形化介面安裝過程的枯燥和乏味,同時可以節省DBA的寶貴時間。
這種方法也是快速構建測試環境的高效方法,可以真實的再現原有資料庫的細節。
Good luck.
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-617447/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux系統安裝jdk——.tar.gz版LinuxJDK
- tar方式安裝資料庫資料庫
- mysql5.7tar包的安裝MySql
- mysql之tar.gz原始碼安裝MySql原始碼
- 快速搭建 Linux(LNMP + Linux 安裝 + 環境配置)LinuxLNMP
- Linux 命令之 tarLinux
- Linux命令篇 - tar 命令Linux
- 安裝mysql-5.6.36-linux-glibc2.5-x86_64.tar.gzMySqlLinux
- yapi 在linux環境下的安裝部署APILinux
- Linux 環境下如何安裝部署 RocketMQ 教程LinuxMQ
- linux環境安裝——mysql安裝複習LinuxMySql
- linux環境安裝——kafka安裝複習LinuxKafka
- Solaris中對tar.z進行安裝解除安裝教程詳解
- Linux安裝jdk環境LinuxJDK
- Linux環境安裝GOLinuxGo
- PostgreSQL tar.gz在centos7上安裝SQLCentOS
- Linux環境Flume安裝配置及使用Linux
- Linux環境Sqoop安裝配置及使用LinuxOOP
- Linux環境Hive安裝配置及使用LinuxHive
- Linux環境Spark安裝配置及使用LinuxSpark
- Linux 下使用 Docker 安裝lnmp環境LinuxDockerLNMP
- Linux環境下MySQL安裝部署操作步驟LinuxMySql
- Linux系統下安裝配置JDK(rpm方式及tar.gz方式)LinuxJDK
- linux環境下解除安裝oracle11gLinuxOracle
- mac 的tar命令--exclude和linux的tar命令--exclude的區別MacLinux
- Linux下安裝Go環境LinuxGo
- Linux環境HBase安裝配置Linux
- linux環境下redis安裝LinuxRedis
- Windows環境下安裝LinuxWindowsLinux
- Linux環境Azkaban安裝配置Linux
- Linux下Java環境安裝LinuxJava
- Linux環境下安裝NginxLinuxNginx
- 如何在 Linux 環境下安裝使用 pycharm?LinuxPyCharm
- Linux 使用Yum安裝Go和配置環境LinuxGo
- 使用VMware Workstation安裝 Linux虛擬環境Linux
- 使用docker搭建環境:安裝tomcat、部署war包DockerTomcat
- ORACLE-LINUX環境字元介面單例項安裝OracleLinux字元單例
- windows環境安裝nc(netcat)命令Windows
- Linux上安裝Nginx依賴環境和庫、Nginx安裝,Nginx服務命令LinuxNginx