linux 手动安装 oracle(转)
?
Linux下安裝Oracle 11
此為參照CU論壇上的高人寫的文章并結合自身環境增加了點細節性的東西
操作系統 CentOS 4.2 2.6.11.8內核
安裝準備
下載Oracle11安裝包
內存最少1G
硬盤空間最6G
交換分區最少1024M,如果不夠就用dd命令擴容一個如:
dd if=/dev/zero of=/.swap bs=1k count=1024000???? 創建文件
chmod 600 /.swap?????????????????????????????? 設置權限
mkswap /.swap????????????????????????????????? 設定文件
swapon /.swap????????????????????????????????? 生效文件
安裝如下軟件
binutils-2.17.50.0.6-2.el5
compat-libstdc++-33-3.2.3-61
elfutils-libelf-0.125-3.el5
elfutils-libelf-devel-0.125
glibc-2.5-12
glibc-common-2.5-12
glibc-devel-2.5-12
gcc-4.1.1-52
gcc-c++-4.1.1-52
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.1-52
libstdc++-4.1.1
libstdc++-devel-4.1.1-52.e15
make-3.81-1.1
sysstat-7.0.0
unixODBC-2.2.11
unixODBC-devel-2.2.11
做個鏈接(老版本要,Oracle11不要)
ln -s /usr/lib/libstdc++.so.6.0.3 /usr/lib/libstdc++.so.5
在sysctl.conf文件中加入下列:
kernel.shmall = 2097152
kernel.shmmax = 2147483648 -- (以字節為單位,物理內存數量*1024*1024*2, 為內存的2倍)
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=8388608
net.core.rmem_max=8388608
net.core.wmem_default=262144
net.core.wmem_max=262144
保存退出
sysctl -p使其生效
設置Shell Limits(系統資源限制),提高軟件的運行效率
在/etc/security/limits.conf文件中加入下列紅色行:
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
在/etc/pam.d/login文件中加入下列行,如果里面沒有的話:
session required /lib/security/pam_limits.so
session required pam_limits.so
在/etc/profile后加入以下語句:
vi /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
創建dba/oper/oinstall組
/usr/sbin/groupadd dba
/usr/sbin/groupadd oper
/usr/sbin/groupadd oinstall
--創建oracle用戶并設置用戶所屬組
/usr/sbin/usermod -g oinstall -G dba oracle
/usr/sbin/useradd -g oinstall -G dba oracle
passwd oracle
# id oracle
uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)
--創建相關安裝目錄
mkdir -p /opt/oracle/product
mkdir -p /opt/oracle/product/OraHome
mkdir -p /opt/oraInventory????????????????????? #(the default inventory folder)
mkdir -p /opt/oracle/oradata?????????????????? #(change the right file owner)
mkdir -p /var/opt/oracle
--設置目錄所有者和權限
chown -R oracle.oinstall /opt/oracle
chown -R oracle.oinstall /opt/oracle/oradata
chown -R oracle.oinstall /opt/oracle/product/OraHome
chown -R oracle.dba /opt/oraInventory
chown oracle.dba /var/opt/oracle
chmod -R 775 /opt/oracle
chmod -R 755 /var/opt/oracle
設置安裝環境變量
# su - oracle --su到oracle用戶下,
更改用戶的一些配置
$vi /home/oracle/.bash_profile
添加以下參數,主要是配置oracle軟件運環境參數
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
?????? . ~/.bashrc
fi
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/OraHome
export ORACLE_SID=orcl
export ORACLE_OWNER=oracle
export ORACLE_TERM=vt100
export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
export CLASSPATH
PATH=$PATH:/usr/sbin; export PATH
PATH=$PATH:/usr/bin; export PATH
注意:
11g:ORA_NLS33=$ORACLE_HOME/nls/admin/data
10g:ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
9i:ORA_NLS33=/oracle/app/ora92/ocommon/nls/admin/data
保存退出
--執行以下命令讓配置馬上生效或以oracle用戶登錄使設置生效
$ source $HOME/.bash_profile
安裝Oracle
首先要進入X界面
然后unzip解壓壓縮包
再進入目錄下執行
./runInstaller
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
( 配置這一步 出錯了... )
安裝過程和Windows下安裝軟件一樣根據提示下一步下一步安裝
在前幾步會提示要檢測你的系統硬件和軟件是否達標,如果有不合規格的會提示報錯要求改正
根據提示信息,將所有設置都設置好,所缺軟件都裝好,就可以了
[oracle@localhost database]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 80 MB.?? Actual 141856 MB??? Passed
Checking swap space: must be greater than 150 MB.?? Actual 1023 MB??? Passed
Checking monitor: must be configured to display at least 256 colors
??? >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.??? Failed <<<<
Some requirement checks failed. You must fulfill these requirements before
continuing with the installation,at which time they will be rechecked.
Continue? (y/n) [n] y
Rechecking installer requirements....
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2009-02-15_06-12-44AM. Please wait ...
DISPLAY not set. Please set the DISPLAY and try again.
Depending on the Unix Shell, you can use one of the following commands as examples to set the DISPLAY environment variable:
- For csh:????????????????????? % setenv DISPLAY 192.168.1.128:0.0
- For sh, ksh and bash:???????? $ DISPLAY=192.168.1.128:0.0; export DISPLAY
Use the following command to see what shell is being used:
??????? echo $SHELL
Use the following command to view the current DISPLAY environment variable setting:
??????? echo $DISPLAY
- Make sure that client users are authorized to connect to the X Server.
To enable client users to access the X Server, open an xterm, dtterm or xconsole as the user that started the session and type the following command:
% xhost +
To test that the DISPLAY environment variable is set correctly, run a X11 based program that comes with the native operating system such as 'xclock':
??????? % <full path to xclock.. see below>
If you are not able to run xclock successfully, please refer to your PC-X Server or OS vendor for further assistance.
Typical path for xclock: /usr/X11R6/bin/xclock
[oracle@localhost database]$
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
不過有時候裝好了它也會定在那個地方不走了
在確定好所有的設置正確和軟件都裝好了
可以用./runInstaller -ignoreSysPrereqs跳過檢測
注意,安裝過程中,盡量不要去更改SID,把默認的SID和一些其它信息記錄下來,可以省去后面的很多麻煩
安裝完畢后,以root身份進入系統 運行
ORACLE_HOME下面的root.sh
完成最后的安裝
Oracle的啟動設置
確定/etc/oratab文件設置每個實例的重啟標志為“Y”:
vim /etc/oratab?
orcl:/opt/oracle/product/OraHome:Y
打開ORACLE_HOME/network/admin/sqlnet.ora添加:
SQLNET.AUTHENTICATION_SERVICE=(NTS)
關閉selinux
啟動EM控制臺
su -oracle
ORACLE_HOME/bin/emctl start dbconsole (就可以訪問https://localhost:1158/em的企業控制臺)
ORACLE_HOME/bin/lsnrctl start
ORACLE_HOME/bin/dbstart
Oracle 常用操作命令
1、su – oracle 不是必需,適合于沒有DBA密碼時使用,可以不用密碼來進入sqlplus界面。
2、sqlplus /nolog 或sqlplus system/manager 或./sqlplus system/manager@ora9i;
3、SQL>connect / as sysdba ;(as sysoper)或connect internal/oracle AS SYSDBA ;(scott/tiger) conn sys/change_on_install as sysdba;
4、SQL>startup; 啟動數據庫實例
5、 查看當前的所有數據庫:
select * from v$database;
select name from v$database;
desc v$databases; 查看數據庫結構字段
7、怎樣查看哪些用戶擁有SYSDBA、SYSOPER權限:
SQL>select * from V_$PWFILE_USERS;
Show user;查看當前數據庫連接用戶
8、進入test數據庫:database test;
9、查看所有的數據庫實例:select * from v$instance;
如:ora9i
10、查看當前庫的所有數據表:
SQL> select TABLE_NAME from all_tables;
select * from all_tables;
SQL> select table_name from all_tables where table_name like ‘u’;
TABLE_NAME———————————————default_auditing_options
11、查看表結構:desc all_tables;
12、顯示CQI.T_BBS_XUSER的所有字段結構:
desc CQI.T_BBS_XUSER;
13、獲得CQI.T_BBS_XUSER表中的記錄:
select * from CQI.T_BBS_XUSER;
14、增加數據庫用戶:(test11/test)
create user test11 identified by test default tablespace users Temporary TABLESPACE Temp;
15、用戶授權:
grant connect,resource,dba to test11;
grant sysdba to test11;
commit;
16、更改數據庫用戶的密碼:(將sys與system的密碼改為test.)
alter user sys indentified by test;
alter user system indentified by test;
http://ilnba.iteye.com/blog/1306586?
?
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的linux 手动安装 oracle(转)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 显示器性能指标有哪些
- 下一篇: Linux shell 脚本中”21″的