一键部署Oracle 11GR2单机

1. 主机准备

主机版本 主机内存 主机磁盘空间 主机IP
Linux version 4.18.0 2G 100G 82.156.213.133

1. 所需软件

  1. -- Linux7系统 缺的rpm
  2. compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
  3. -- Oracle的安装包
  4. p13390677_112040_Linux-x86-64_1of7.zip
  5. p13390677_112040_Linux-x86-64_2of7.zip
  6. -- 运行安装脚本
  7. OracleShellInstall.sh

2. 操作步骤

1. 前期准备

  1. ## 1. 挂载ISO镜像(二选一)
  2. ## 1.1 通过cdrom挂载
  3. mount /dev/cdrom /mnt
  4. ## 1.2通过安装镜像源挂载
  5. mount -o loop /isofile/CentOS-7-x86_64-DVD-1503-01.iso /mnt
  6. ## 2.创建安装介质上传目录
  7. [root@localhost ~]# mkdir /soft
  8. [root@localhost ~]# cd /soft/
  9. ## 3.上传所需要的所有软件放到同级别目录
  10. [root@localhost ~]# chmod +x OracleShellInstall.sh
  11. ## 4.执行脚本
  12. ## -i 公共ip
  13. ## -n hostname
  14. ## -o oraclesid
  15. ## -op oracle user password
  16. ## -b install basedir
  17. ## -s characterse
  18. ## -c is cdb or not(TRUE|FALSE)
  19. [root@localhost ~]# ./OracleShellInstall.sh -i 82.156.213.133 -n s11g -o oracle -c FLASE -op oracle -b /oracle/app -s ZHS16GBK
  20. ## 安装目录记录在/soft目录下 OracleAllSilent.*log,在文末展示安装目录

image.png

2. 数据库登录验证

  1. [root@s11g ~]# su - oracle
  2. Last login: Tue Dec 7 21:27:10 CST 2021 on pts/1
  3. ## 第一种验证方式
  4. [oracle@s11g:/home/oracle]$ sas
  5. SQL> select instance_name,status from v$instance;
  6. INSTANCE_NAME STATUS
  7. ---------------- ------------
  8. oracle OPEN
  9. ## 第二种验证方式 sysdba登录
  10. sqlplus / as sysdba
  11. sqlplus / as sysdba@ORCL
  12. ## 第三种连接方式(远程访问)
  13. ./sqlplus SCOTT/oracle@82.156.213.133:1521/oracle

3. 其他操作

创建新用户以及数据

  1. ## Oracle数据库,创建测试表
  2. [oracle@s11g:/home/oracle]$ sqlplus / as sysdba
  3. SQL> drop user scott cascade;
  4. SQL> create user scott identified by oracle;
  5. SQL> grant dba to scott;
  6. SQL> conn scott/oracle
  7. ## 第一批数据
  8. SQL> create table scott.T1
  9. (
  10. name VARCHAR2(20),
  11. age INTEGER,
  12. sex VARCHAR2(3),
  13. grade INTEGER
  14. );
  15. insert into scott.t1 values('丽丽',18,'女',1000);
  16. commit;
  17. ## 第二批数据
  18. create table TCE(ID CHAR(10),CREATE_DATE DATE );
  19. insert into TCE VALUES(1, to_date('2019-2-26 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));
  20. insert into TCE VALUES(2, to_date('2019-2-27 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));
  21. insert into TCE VALUES(3, to_date('2019-2-28 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));
  22. insert into TCE VALUES(4, to_date('2019-3-1 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));
  23. insert into TCE VALUES(5, to_date(to_char('2021-12-05 11:14:25' , 'yyyy-mm-dd hh24:mi:ss')));
  24. insert into TCE VALUES(6, to_date('2021-12-06 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));
  25. insert into TCE VALUES(7, to_date('2021-12-07 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));
  26. insert into TCE VALUES(8, to_date('2021-12-08 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));
  27. insert into TCE VALUES(9, to_date('2021-12-09 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));
  28. insert into TCE VALUES(10, to_date('2021-12-10 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));
  29. insert into TCE VALUES(11, to_date('2021-12-11 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));
  30. select * from TCE where CREATE_DATE > to_date(to_char('2019-2-27 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));

环境变量

  1. [oracle@s11g:/lib64]$ vim ~/.bash_profile
  2. ################OracleBegin#########################
  3. umask 022
  4. export TMP=/tmp
  5. export TMPDIR=$TMP
  6. export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK #AL32UTF8,ZHS16GBK
  7. export ORACLE_BASE=/oracle/app/oracle
  8. export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db
  9. export ORACLE_HOSTNAME=s11g
  10. export ORACLE_TERM=xterm
  11. export TNS_ADMIN=$ORACLE_HOME/network/admin
  12. export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
  13. export ORACLE_SID=oracle
  14. export PATH=/usr/sbin:$PATH
  15. export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
  16. alias sas='sqlplus / as sysdba'
  17. alias alert='tail -500f $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace/alert_$ORACLE_SID.log|more'
  18. export PS1="[`whoami`@`hostname`:"'$PWD]$ '
  19. ################OracleEnd###########################

4. 引用

https://blog.csdn.net/m0_50546016/article/details/116503394

5. 资料

链接:https://pan.baidu.com/s/1XP-ZCBfBxOWk_ShMVf0W8A 
提取码:omba 
--来自百度网盘超级会员V3的分享