day01: oracle12C在Linux7.5上图形化安装部署方法:
生活随笔
收集整理的這篇文章主要介紹了
day01: oracle12C在Linux7.5上图形化安装部署方法:
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
一? 安裝步驟
1、安裝依賴軟件包
yum install -y compat-libcap1 glibc-devel ksh libaio-devel libstdc++-devel gcc gcc-c++ unixODBC2、創(chuàng)建安裝組和用戶
groupadd oinstallgroupadd dbauseradd -g oinstall -G dba oraclepasswd oracle? ? ? ? ? ? ? ? ? ?&&??# echo oracle | passwd --stdin oracleid oracle uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba)3、修改內核參數(shù)
1)共享內存
vim /etc/sysctl.conffs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 4294967295 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576# sysctl -p //立即生效修改內核參數(shù)2)資源限制
vim /etc/security/limits.conforacle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 102404、創(chuàng)建數(shù)據(jù)庫安裝目錄
root@ocp003 ~]# mkdir -p /u01/app [root@ocp003 ~]# chown -R oracle:oinstall /u01/app/ [root@ocp003 ~]# chmod -R 775 /u01/app/ [root@ocp003 ~]# ll /u01/app/ -d drwxrwxr-x. 2 oracle oinstall 6 Jul 20 05:52 /u01/app/5、上傳oracle安裝包到家目錄,解壓、修改權限
# cd /home/oracle/ # unzip linuxx64_12201_database.zip # chmod 777 database/ -R # chown oracle:oinstall database/ -R6、在服務器端用圖形化安裝
注意:在服務器圖形安裝要直接登錄到oracle用戶,不要切換用戶;想要客戶端調用圖形化安裝要root執(zhí)行? #? xhost? +
登錄oracle用戶執(zhí)行安裝 # cd database/ 服務器端執(zhí)行 [oracle@ocp003 database]$ ./runInstaller用客戶端調用圖形執(zhí)行 修改圖形訪問控制 [root@localhost oracle]# xhost + access control disabled, clients can connect from any host按照下圖以此執(zhí)行:
[root@localhost ~]# /u01/app/oraInventory/orainstRoot.sh [root@localhost ~]# /u01/app/oracle/product/12.2.0/dbhome_1/root.sh==========安裝完工
?
二? Oracle環(huán)境變量設置
1、添加環(huán)境變量(把oracle新安裝目錄添加到 PATH環(huán)境變量)
[root@ocp003 ~]# su - oracle方法一: 自動配置環(huán)境變量
[oracle@ocp003 ~]$ . oraenv //一次性,每次啟動要重新設置 ORACLE_SID = [oracle] ? orcl The Oracle base has been set to /u01/app/oracle[oracle@ocp003 ~]$ sqlplus //可以執(zhí)行,環(huán)境變量生效方法二: 手動添加環(huán)境變量
[oracle@localhost ~]$ vim .bash_profile 追加如下內容: export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1/ export ORACLE_SID=orcl export PATH=$PATH:$ORACLE_HOME/bin追加完成之后,需要生效該環(huán)境變量 [oracle@localhost ~]$ source .bash_profile?
三? 連接使用oralce
1? ?sqlplus 的基本使用
***: sql輸入時輸入錯誤按:Ctrl+退格鍵? ——可以刪除輸入錯誤
[oracle@ocp003 ~]$ sqlplus / as sysdbaSQL> select instance_name,status from v$instance; //查看當前數(shù)據(jù)庫的名稱和狀態(tài) SQL> select open_mode from V$database; //查看當前的open狀態(tài)SQL> create user c##reyn identified by reyn_passwd; //創(chuàng)建oralce用戶reyn SQL> grant connect,resource to c##reyn; //給reyn授權限 SQL> alter user c##reyn quota unlimited on users;2、創(chuàng)建scott用戶,并使用scott用戶連接
SQL> create user c##scott identified by oracle; SQL> grant connect,resource to c##scott; SQL> alter user c##scott quota unlimited on users;SQL> conn c##scott/oracle //使用scott用戶連接 SQL> show user;SQL> @/home/oracle/scott.sql //執(zhí)行外部sql語句腳本SQL> select table_name from user_tables; //查詢當前用戶有哪些表 SQL> select * from tab; //查詢用戶的表SQL> desc tmp //查詢表結構 SQL> select * from dept; //查詢dept表 SQL> select deptno,loc from dept; //查詢dept表的指定字段?
四? 數(shù)據(jù)庫的啟動和關閉
?
sqlplus的基本用法: SQL> conn[ect]setdescshutdown immediatestartupshow useroracle下監(jiān)聽的啟動、關閉:(Linux)# lsnctl start //啟動監(jiān)聽 # sqlplus / as sysdba > startup //啟動數(shù)據(jù)庫 >shutdown immediate //關閉數(shù)據(jù)庫?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
總結
以上是生活随笔為你收集整理的day01: oracle12C在Linux7.5上图形化安装部署方法:的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: DBA表现最好的7个习惯
- 下一篇: day02: SQL_DML, ora