Oracle for Linux 安裝前環境配置指令碼(轉)
#!/usr/bin/PERL
#Ver 1.0
#nailxu
#License GPL
print "***********************************************************************\n";
print "** Now,let's begining to make preparation for installing the ORACLE. **\n";
print "-----------------------------------------------------------------------\n";
#this is the function to set Oracle's Version.
sub VER{
print "1st>,please set the Version of the ORACLE(cann't be blank):";
$ver=;
chomp $ver;
while($ver eq ""){
VER();
}
}
VER();
print "the oracle's version is ${ver}\n";
#this is the function to set $ORACLE_HOME.
sub HOMEDIR{
print "2nd>,please set the ORACLE_HOME of the Database(cann't be blank):";
$homedir=;
chomp $homedir;
while($homedir eq ""){
HOMEDIR();
}
}
HOMEDIR();
print "the \$ORACLE_HOME is ${homedir}\n";
#this is the function to set SID.
sub SID{
print "3rd>,please set the SID(cann't be blank):";
$sid=;
chomp $sid;
while($sid eq ""){
SID();
}
}
SID();
print "the SID is $sid\n";
#this is the function to set CharacterSet.
sub CHA{
print "4th>,please set the CharacterSet of the Database(cann't be blank):";
$cha=;
chomp $cha;
while($cha eq ""){
CHA();
}
}
CHA();
print "the characterSet is $cha\n";
print "----------------------------------------------------------------------\n";
sub verifyINPUT{
print "OK,ALL the paramter have been input as follow:\n";
print "Oracle version is $ver\n";
print "ORACLE_HOME is $homedir\n";
print "ORACLE SID is $sid\n";
print "ORACLE CharacterSet is $cha\n";
print "Are U sure your input[y is yes,n is no]:";
$input=;
chomp $input;
if($input ne "y"){
print "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
print "U think you have something wrong input,please reexecute the script.\n";
print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
exit;
}else{
print "-------------------------------------------------------------------\n";
print "U have finished the input,I will prepare the envirment for your oracle installation,please wait ... ...\n";
createuser();
createdir();
formatpro();
formatker();
formatlim();
}
}
verifyINPUT();
#create the oracle user
sub createuser{
system("groupadd dba");
system("groupadd oinstall");
system("useradd -g oinstall -G dba oracle");
#the init password of oracle is oracle
system("echo oracle|passwd --stdin oracle");
}
#create the oracle_home
sub createdir{
system("mkdir -p ${homedir}/${ver}");
system("chown -R oracle.oinstall ${homedir}");
system("chmod -R 766 ${homedir}");
}
#format the oracle.bash_profile
sub formatpro{
system("echo export ORACLE_BASE=${homedir} >> /home/oracle/.bash_profile");
system("echo export ORACLE_HOME=${homedir}/${ver} >> /home/oracle/.bash_profile");
system("echo export ORACLE_SID=$sid >> /home/oracle/.bash_profile");
system("echo export ORACLE_TERM=xterm >> /home/oracle/.bash_profile");
system("echo export LD_ASSUME_KERNEL=2.4.19 >> /home/oracle/.bash_profile");
system("echo export NLS_LANG=AMERICAN_AMERICA.$cha >> /home/oracle/.bash_profile");
system("echo 'export ORA_NLS33=\$ORACLE_HOME/ocommon/nls/admin/data' >> /home/oracle/.bash_profile");
system("echo 'LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib' >> /home/oracle/.bash_profile");
system("echo 'LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib' >> /home/oracle/.bash_profile");
system("echo export LD_LIBRARY_PATH >> /home/oracle/.bash_profile");
system("echo 'export PATH=\$PATH:\$ORACLE_HOME/bin' >> /home/oracle/.bash_profile");
}
sub getmem{
$mem=`cat /proc/meminfo|grep MemTotal |tr -d ' '`;
chomp($mem);
$len=length($mem);
$mem=substr("$mem",9,$len-11);
$mem=$mem*1024;
$shmmax=$mem/2;
#print "The memory is ${mem}Byte,and the kernel.shmmax should be ${shmmax}\n";
}
sub formatker{
getmem();
system("echo kernel.shmmax = ${shmmax} >> /etc/sysctl.conf");
system("echo kernel.shmmni = 4096 >> /etc/sysctl.conf");
system("echo kernel.shmall = 2097152 >> /etc/sysctl.conf");
system("echo kernel.sem = 250 3200 100 128 >> /etc/sysctl.conf");
system("echo fs.file-max = 65536 >> /etc/sysctl.conf");
system("echo.NET.ipv4.ip_local_port_range = 1024 6500 >> /etc/sysctl.conf");
}
sub formatlim{
system("echo oracle soft nofile 65536 >> /etc/security/limits.conf");
system("echo oracle hard nofile 65536 >> /etc/security/limits.conf");
system("echo oracle soft nproc 16384 >> /etc/security/limits.conf");
system("echo oracle hard nproc 16384 >> /etc/security/limits.conf");
}
*************************************************************************
LINUX中也有自己的RMAN工具,而非oracle的RMAN,所以如果沒有在環境變數中設定oracle的RMAN的話,就需要到ORALCE/HOME目錄中的rman目錄下去執行RMAN命令,這時候就會進入ORACLE的RMAN.
[oracle@smsdbrac1 oracle]$ which rman
/usr/X11R6/bin/rman
在Oracle使用者的環境變數下,將$ORACLE_HOME/bin放在PATH變數前就可以了:
export PATH=$ORACLE_HOME/bin:$PATH
讀者可以更改上述指令碼中相應行即可。
詳細出處參考:http://www.itqun.net/content-detail/101693_3.html
#Ver 1.0
#nailxu
#License GPL
print "***********************************************************************\n";
print "** Now,let's begining to make preparation for installing the ORACLE. **\n";
print "-----------------------------------------------------------------------\n";
#this is the function to set Oracle's Version.
sub VER{
print "1st>,please set the Version of the ORACLE(cann't be blank):";
$ver=
chomp $ver;
while($ver eq ""){
VER();
}
}
VER();
print "the oracle's version is ${ver}\n";
#this is the function to set $ORACLE_HOME.
sub HOMEDIR{
print "2nd>,please set the ORACLE_HOME of the Database(cann't be blank):";
$homedir=
chomp $homedir;
while($homedir eq ""){
HOMEDIR();
}
}
HOMEDIR();
print "the \$ORACLE_HOME is ${homedir}\n";
#this is the function to set SID.
sub SID{
print "3rd>,please set the SID(cann't be blank):";
$sid=
chomp $sid;
while($sid eq ""){
SID();
}
}
SID();
print "the SID is $sid\n";
#this is the function to set CharacterSet.
sub CHA{
print "4th>,please set the CharacterSet of the Database(cann't be blank):";
$cha=
chomp $cha;
while($cha eq ""){
CHA();
}
}
CHA();
print "the characterSet is $cha\n";
print "----------------------------------------------------------------------\n";
sub verifyINPUT{
print "OK,ALL the paramter have been input as follow:\n";
print "Oracle version is $ver\n";
print "ORACLE_HOME is $homedir\n";
print "ORACLE SID is $sid\n";
print "ORACLE CharacterSet is $cha\n";
print "Are U sure your input[y is yes,n is no]:";
$input=
chomp $input;
if($input ne "y"){
print "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
print "U think you have something wrong input,please reexecute the script.\n";
print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
exit;
}else{
print "-------------------------------------------------------------------\n";
print "U have finished the input,I will prepare the envirment for your oracle installation,please wait ... ...\n";
createuser();
createdir();
formatpro();
formatker();
formatlim();
}
}
verifyINPUT();
#create the oracle user
sub createuser{
system("groupadd dba");
system("groupadd oinstall");
system("useradd -g oinstall -G dba oracle");
#the init password of oracle is oracle
system("echo oracle|passwd --stdin oracle");
}
#create the oracle_home
sub createdir{
system("mkdir -p ${homedir}/${ver}");
system("chown -R oracle.oinstall ${homedir}");
system("chmod -R 766 ${homedir}");
}
#format the oracle.bash_profile
sub formatpro{
system("echo export ORACLE_BASE=${homedir} >> /home/oracle/.bash_profile");
system("echo export ORACLE_HOME=${homedir}/${ver} >> /home/oracle/.bash_profile");
system("echo export ORACLE_SID=$sid >> /home/oracle/.bash_profile");
system("echo export ORACLE_TERM=xterm >> /home/oracle/.bash_profile");
system("echo export LD_ASSUME_KERNEL=2.4.19 >> /home/oracle/.bash_profile");
system("echo export NLS_LANG=AMERICAN_AMERICA.$cha >> /home/oracle/.bash_profile");
system("echo 'export ORA_NLS33=\$ORACLE_HOME/ocommon/nls/admin/data' >> /home/oracle/.bash_profile");
system("echo 'LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib' >> /home/oracle/.bash_profile");
system("echo 'LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib' >> /home/oracle/.bash_profile");
system("echo export LD_LIBRARY_PATH >> /home/oracle/.bash_profile");
system("echo 'export PATH=\$PATH:\$ORACLE_HOME/bin' >> /home/oracle/.bash_profile");
}
sub getmem{
$mem=`cat /proc/meminfo|grep MemTotal |tr -d ' '`;
chomp($mem);
$len=length($mem);
$mem=substr("$mem",9,$len-11);
$mem=$mem*1024;
$shmmax=$mem/2;
#print "The memory is ${mem}Byte,and the kernel.shmmax should be ${shmmax}\n";
}
sub formatker{
getmem();
system("echo kernel.shmmax = ${shmmax} >> /etc/sysctl.conf");
system("echo kernel.shmmni = 4096 >> /etc/sysctl.conf");
system("echo kernel.shmall = 2097152 >> /etc/sysctl.conf");
system("echo kernel.sem = 250 3200 100 128 >> /etc/sysctl.conf");
system("echo fs.file-max = 65536 >> /etc/sysctl.conf");
system("echo.NET.ipv4.ip_local_port_range = 1024 6500 >> /etc/sysctl.conf");
}
sub formatlim{
system("echo oracle soft nofile 65536 >> /etc/security/limits.conf");
system("echo oracle hard nofile 65536 >> /etc/security/limits.conf");
system("echo oracle soft nproc 16384 >> /etc/security/limits.conf");
system("echo oracle hard nproc 16384 >> /etc/security/limits.conf");
}
*************************************************************************
LINUX中也有自己的RMAN工具,而非oracle的RMAN,所以如果沒有在環境變數中設定oracle的RMAN的話,就需要到ORALCE/HOME目錄中的rman目錄下去執行RMAN命令,這時候就會進入ORACLE的RMAN.
[oracle@smsdbrac1 oracle]$ which rman
/usr/X11R6/bin/rman
在Oracle使用者的環境變數下,將$ORACLE_HOME/bin放在PATH變數前就可以了:
export PATH=$ORACLE_HOME/bin:$PATH
讀者可以更改上述指令碼中相應行即可。
詳細出處參考:http://www.itqun.net/content-detail/101693_3.html
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70109/viewspace-689622/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux環境HBase安裝配置Linux
- Linux環境Azkaban安裝配置Linux
- Linux環境下nginx安裝配置LinuxNginx
- 快速搭建 Linux(LNMP + Linux 安裝 + 環境配置)LinuxLNMP
- Linux環境Spark安裝配置及使用LinuxSpark
- Linux環境Flume安裝配置及使用Linux
- Linux環境Sqoop安裝配置及使用LinuxOOP
- Linux環境Hive安裝配置及使用LinuxHive
- linux下expect環境安裝以及簡單指令碼測試Linux指令碼
- Linux環境安裝Oracle11g(一)——配置檢查及依賴項安裝LinuxOracle
- (轉)Windows下安裝Docker, GitBash環境配置WindowsDockerGit
- Linux 使用Yum安裝Go和配置環境LinuxGo
- LINUX 環境 mysql to mysql OGG安裝配置(二)LinuxMySql
- Linux-RHEL7環境MySQL安裝配置LinuxMySql
- Linux-CentOS7環境MySQL安裝配置LinuxCentOSMySql
- linux環境下解除安裝oracle11gLinuxOracle
- oracle 11g RAC 安裝前準備指令碼Oracle指令碼
- Linux環境安裝Oracle11g(三)——使用者、路徑建立及配置環境變數LinuxOracle變數
- jdk在linux下安裝、配置環境變數JDKLinux變數
- linux系統安裝jdk,配置環境變數LinuxJDK變數
- Linux環境下的Android的ADK安裝配置LinuxAndroid
- Linux & Windows 環境下 RabbitMQ 安裝與基本配置LinuxWindowsMQ
- Linux & Windows 環境下 Redis 安裝與基本配置LinuxWindowsRedis
- Linux環境下elasticsearch-6.2.2安裝以及配置LinuxElasticsearch
- ORACLE-LINUX環境字元介面單例項安裝OracleLinux字元單例
- Linux安裝jdk環境LinuxJDK
- Linux環境安裝GOLinuxGo
- Linux環境PostGIS原始碼編譯安裝Linux原始碼編譯
- 嵌入式 Linux 基礎:環境配置(Debian 12 安裝配置)Linux
- Linux下安裝Python,以及環境變數的配置LinuxPython變數
- Linux 環境 Intelij Idea 安裝與快捷圖示配置LinuxIntelIdea
- Git環境配置與安裝Git
- GoLand安裝及環境配置GoLand
- scala安裝及環境配置
- Java安裝和環境配置Java
- angular環境配置及安裝Angular
- [SQL Server玩轉Python] 一.安裝環境及T-SQL呼叫python指令碼SQLServerPython指令碼
- linux環境安裝——mysql安裝複習LinuxMySql
- linux環境安裝——kafka安裝複習LinuxKafka