您好,登錄后才能下訂單哦!
一、修改oracle用戶環境變量
[oracle@oracle ~]$ su - oracle [oracle@oracle ~]$ vim .bash_profile
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1 export ORACLE_SID=ORACLEDB export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin export PATH
[oracle@oracle ~]$ source .bash_profile
二、啟動監聽
[oracle@oracle ~]$ lsnrctl start
三、手工建庫
1、創建Oracle數據目錄:
1: [oracle@oracle ~]$ mkdir -p $ORACLE_BASE/oradata/ORACLEDB 2: [oracle@oracle ~]$ mkdir -p $ORACLE_BASE/admin/ORACLEDB 3: [oracle@oracle ~]$ mkdir -p $ORACLE_BASE/flash_recovery_area
2、創建Oracle的口令認證
1: [oracle@oracle ~]$ cd $ORACLE_HOME/dbs 2: [oracle@oracle dbs]$ orapwd file=orapwORACLEDB password=oracle entries=30
3、創建初始化參數文件
a、以官方參數文件為模板創建初始化參數文件
1: [oracle@oracle ~]cd $ORACLE_HOME/dbs 2: [oracle@oracle ~]cat init.ora |grep -v ^#|grep -v ^$> initORACLEDB.ora
b、修改初始化參數文件
修改前:
db_name='ORCL' memory_target=1G processes = 150 audit_file_dest='<ORACLE_BASE>/admin/orcl/adump' audit_trail ='db' db_block_size=8192 db_domain='' db_recovery_file_dest='<ORACLE_BASE>/flash_recovery_area' db_recovery_file_dest_size=2G diagnostic_dest='<ORACLE_BASE>' dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)' open_cursors=300 remote_login_passwordfile='EXCLUSIVE' undo_tablespace='UNDOTBS1' # You may want to ensure that control files are created on separate physical # devices control_files = (ora_control1, ora_control2) compatible ='11.2.0'
在vim末行命令的編輯狀態中輸入
1: :%s#orcl#ORACLEDB#gi里面替換的orcl的字符串。其中i命令不區分大小寫。 2: :%s#ora_control1#/u01/app/oracle/oradata/ORACLEDB/control01.ctl#g替換ora_control1的字符串。 3: :%s#ora_control2#/u01/app/oracle/oradata/ORACLEDB/control02.ctl#g替換ora_control2的字符串。 4: :%s#<ORACLE_BASE>#/u01/app/oracle#g替換<ORACLE_BASE>的字符串。 5: :wq命令保存配置
修改后:
db_name='ORACLEDB' memory_target=1G processes = 150 audit_file_dest='/u01/app/oracle/admin/ORACLEDB/adump' audit_trail ='db' db_block_size=8192 db_domain='' db_recovery_file_dest='/u01/app/oracle/flash_recovery_area' db_recovery_file_dest_size=2G diagnostic_dest='/u01/app/oracle' dispatchers='(PROTOCOL=TCP) (SERVICE=ORACLEDBXDB)' open_cursors=300 remote_login_passwordfile='EXCLUSIVE' undo_tablespace='UNDOTBS1' # You may want to ensure that control files are created on separate physical # devices control_files = (/u01/app/oracle/oradata/ORACLEDB/control01.ctl, /u01/app/oracle/oradata/ORACLEDB/control02.ctl) compatible ='11.2.0'
4、連接數據庫實例
1: 命令文件連接: 2: [oracle@oracle ~]sqlplus sys/oracle as sysdba 3: SYS@>create spfile from pfile;
5、啟動實例
1: SYS@>startup nomount
6、在當前目錄創建create database語句創建數據庫
CREATE DATABASE ORACLEDB USER SYS IDENTIFIED BY oracle USER SYSTEM IDENTIFIED BY oracle LOGFILE GROUP 1 ('/u01/app/oracle/oradata/ORACLEDB/redo01a.log','/u01/app/oracle/oradata/ORACLEDB/redo01b.log') SIZE 100M BLOCKSIZE 512, GROUP 2 ('/u01/app/oracle/oradata/ORACLEDB/redo02a.log','/u01/app/oracle/oradata/ORACLEDB/redo02b.log') SIZE 100M BLOCKSIZE 512, GROUP 3 ('/u01/app/oracle/oradata/ORACLEDB/redo03a.log','/u01/app/oracle/oradata/ORACLEDB/redo03b.log') SIZE 100M BLOCKSIZE 512 MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 CHARACTER SET AL32UTF8 NATIONAL CHARACTER SET AL16UTF16 EXTENT MANAGEMENT LOCAL DATAFILE '/u01/app/oracle/oradata/ORACLEDB/system01.dbf' SIZE 325M REUSE SYSAUX DATAFILE '/u01/app/oracle/oradata/ORACLEDB/sysaux01.dbf' SIZE 325M REUSE DEFAULT TABLESPACE users DATAFILE '/u01/app/oracle/oradata/ORACLEDB/users01.dbf' SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE '/u01/app/oracle/oradata/ORACLEDB/temp01.dbf' SIZE 20M REUSE UNDO TABLESPACE undotbs1 DATAFILE '/u01/app/oracle/oradata/ORACLEDB/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
給文件授予權限,并執行腳本:
1: [oracle@oracle dbs]chmod 755 create_database.sql 2: [oracle@oracle dbs]sqlplus / as sysdba 3: SYS@>@create_database.sql 4: Database created.
7、執行腳本并構建數據字典視圖
1: [oracle@oracle ~] sqlplus / as sysdba 2: SYS@>@?/rdbms/admin/catalog.sql 3: SYS@>@?/rdbms/admin/catproc.sql 4: SYS@>@?/rdbms/admin/utlrp.sql
8、使用system用戶登錄,執行腳本
1: [oracle@oracle ~]sqlplus system/oracle 2: SYSTEM@> @?/sqlplus/admin/pupbld.sql
四、驗證數據庫,是否正常:
1:[oracle@oracle ~]sqlplus / as sysdba 2:SYS@>select INSTANCE_NAME,STATUS from v$instance; INSTANCE_NAME STATUS ---------------- ------------ OEACLEDB OPEN
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。