天天看點

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

一、oracle的安裝,在官網下載下傳oracle11g R2

1、在桌面單擊右鍵,選擇“在終端中打開”,進入終端

輸入指令:su

輸入ROOT密碼:

建立使用者組oinstall:groupadd oinstall

建立使用者組dba:groupadd dba

建立oracle使用者,并加入到oinstall和dba使用者組:useradd -g oinstall -g dba -m oracle

設定使用者oracle登入密碼,需要确認一次,注意兩次密碼要一樣(注意:此處的密碼是oracle賬戶登入密碼):passwd oracle

檢視建立的oracle使用者:id oracle

2、建立oracle資料庫安裝目錄

oracle資料庫安裝目錄:mkdir -p /data/oracle

oracle資料庫配置檔案目錄:mkdir -p /data/oraInventory

oracle資料庫軟體包解壓目錄:mkdir -p /data/database

再輸入:cd /data

建立完畢檢查一下:ls

設定目錄所有者為oinstall使用者組的oracle使用者:chown -R oracle:oinstall /data/oracle

再輸入:chown -R oracle:oinstall /data/oraInventory

再輸入:chown -R oracle:oinstall /data/database

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

3、修改os系統辨別

因為oracle預設不支援Centos系統安裝,需要修改為對應的RedHat版本。

檢視目前系統版本:cat /proc/version

輸入:vi /etc/redhat-release

進入到編輯模式了,點選鍵盤上的“insert”按鈕,再将第一行替換為redhat-7,按Esc按鈕,輸入:wq,注意這裡有一個冒号,再回車,儲存并退出(注意:後面所有修改檔案的方法均如此,故不再贅述)。

4、關閉防火牆

關閉防火牆:systemctl stop firewalld.service

禁止使用防火牆:systemctl disable firewalld.service

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

5、關閉selinux

進入編輯狀态:vi /etc/selinux/config

将SELINUX的值改為disabled,儲存并退出。

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

6、修改核心參數

進入編輯狀态:vi /etc/sysctl.conf

在最後添加如下代碼:

net.ipv4.icmp_echo_ignore_broadcasts = 1

net.ipv4.conf.all.rp_filter = 1

fs.file-max = 6815744

fs.aio-max-nr = 1048576

kernel.shmall = 2097152

kernel.shmmax = 2147483648

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

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

7、對oracle使用者設定限制,提高軟體運作性能

進入編輯狀态:vi /etc/security/limits.conf

找到最後一行# End of file,在它上面空行處添加如下代碼:

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

儲存并退出。

8、配置使用者的環境變量

進入編輯狀态:vi /home/oracle/.bash_profile

在最後添加如下代碼:

export ORACLE_BASE=/data/oracle #oracle資料庫安裝目錄

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export ORACLE_SID=orcl #oracle啟動資料庫執行個體名

export ORACLE_TERM=xterm

export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export LANG=C

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

儲存并退出。

使上述配置立即生效:source /home/oracle/.bash_profile

9、上述都搞定了,便可以進行oracle的安裝了。

10、切換使用者到oracle使用者。如下圖所示,單擊桌面右上角的三角形圖示,單擊你的使用者名稱,單擊切換使用者。輸入你前面設定的oracle賬戶登入密碼。将oracle解壓後的檔案複制到桌面上,名字為database,輕按兩下進入該檔案夾,空白處單擊右鍵,選擇Open in Terminal進入終端界面。

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

11、開始安裝

為了避免安裝過程出現亂碼,輸入指令:export LANG=en_US.UTF-8

啟動oracle安裝:./runInstaller

1)進入安裝界面,如下圖所示,去掉“I wish receive security via My Oracle Support”的勾選,單擊“next”,選“yes”繼續。

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作
centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

2)選中“Create and configure a database”,點選“next”。

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

3)選中“Desk Class”,點選“next”。

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

4)進入下圖界面,在“Administrative password”輸入密碼,在“Confirm password”确認密碼。點選“next”,出現一個小豎線在中間,單擊“Tab”鍵,單擊“Enter”。

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作
centos oracle建表,centos7下oracle11g詳細的安裝與建表操作
centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

5)單擊“next”,勾上右上角的“ignore all”。單擊“next”,再單擊“finish”開始安裝。

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作
centos oracle建表,centos7下oracle11g詳細的安裝與建表操作
centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

6)安裝界面如下圖所示,當安裝進度進行到68%時,會出現兩次中間有小豎線的情況,将滑鼠放在小豎線上單擊右鍵選擇“close”,或者直接單擊空格鍵,可以繼續安裝。

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作
centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

7)當安裝進行到95%時,會出現下圖所示界面,單擊“ok”,再出現繼續單擊“ok”,開始安裝資料庫執行個體。安裝進行到100%時,會再次出現安裝界面變灰的情況,界面中間有一條豎線,将滑鼠放上去可以拉開,單擊“ok”。最後,安裝結束,單擊“close”。

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作
centos oracle建表,centos7下oracle11g詳細的安裝與建表操作
centos oracle建表,centos7下oracle11g詳細的安裝與建表操作
centos oracle建表,centos7下oracle11g詳細的安裝與建表操作
centos oracle建表,centos7下oracle11g詳細的安裝與建表操作
centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

安裝完成後,退出oracle賬戶,進入root賬戶。

在桌面單擊右鍵,選擇“在終端中打開”,輸入:su - oracle

輸入密碼,切換到oracle使用者。

啟動監聽:lsnrctl start

輸入:sqlplus /nolog

輸入:conn sys/[email protected] as sysdba

其中,orcl是執行個體名,123是它的密碼。如果出現下圖所示的“Connected.”則連接配接成功,說明資料庫建立成功。

centos oracle建表,centos7下oracle11g詳細的安裝與建表操作

二、oracle的配置

1、建立表空間

打開終端,輸入:su - oracle

輸入密碼:

輸入:sqlplus “/as sysdba” (此處是用dba身份登入資料庫,系統的超級使用者)

建立臨時表空間:

create temporary tablespace table_test tempfile ‘/data/oracle/table_test.dbf ‘ 點選Enter

size 1024m 點選Enter

autoextend on 點選Enter

next 100m maxsize 10240m 點選Enter

extent management local; 點選Enter

說明:

1) table_test是臨時表空間的名字

2) /data/oracle/table_test.dbf是在/data/oracle下建一個名為table_test.dbf的表(注意:單引号為英文狀态下的輸入),

3) 1024m是表空間初始大小,

4) 100m是表空間自動增長大小,

5) 10240m是表空間最大的大小。

2、建立資料表空間

create tablespace data logging datafile ‘/data/oracle/data.dbf‘ 點選Enter

size 1024m 點選Enter

autoextend on 點選Enter

next 100m maxsize 10240m 點選Enter

extent management local; 點選Enter

3、建立使用者并指定表空間

create user data identified by 123 default tablespace data temporary tablespacetable_test;

其中data為使用者名,123為使用者密碼,table_test是臨時表空間的名字。

4、給使用者授予權限

grant dba to data;

至此,oracle在centos7下的安裝和配置也就完成了,别人已經可以通路你的資料庫了

centos7下oracle11g詳細的安裝與建表操作

标簽:選中   檔案的   version   centos7   roc   豎線   dba   使用者密碼   http

本條技術文章來源于網際網路,如果無意侵犯您的權益請點選此處回報版權投訴 本文系統來源:http://www.cnblogs.com/guzhanyu/p/7943728.html