一键部署Oracle 11GR2单机
1. 主机准备
| 主机版本 |
主机内存 |
主机磁盘空间 |
主机IP |
| Linux version 4.18.0 |
2G |
100G |
82.156.213.133 |
1. 所需软件
-- Linux7系统 缺的rpm包compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm-- Oracle的安装包p13390677_112040_Linux-x86-64_1of7.zipp13390677_112040_Linux-x86-64_2of7.zip-- 运行安装脚本OracleShellInstall.sh
2. 操作步骤
1. 前期准备
## 1. 挂载ISO镜像(二选一) ## 1.1 通过cdrom挂载 mount /dev/cdrom /mnt ## 1.2通过安装镜像源挂载 mount -o loop /isofile/CentOS-7-x86_64-DVD-1503-01.iso /mnt## 2.创建安装介质上传目录[root@localhost ~]# mkdir /soft[root@localhost ~]# cd /soft/## 3.上传所需要的所有软件放到同级别目录[root@localhost ~]# chmod +x OracleShellInstall.sh## 4.执行脚本## -i 公共ip## -n hostname## -o oraclesid## -op oracle user password## -b install basedir## -s characterse## -c is cdb or not(TRUE|FALSE) [root@localhost ~]# ./OracleShellInstall.sh -i 82.156.213.133 -n s11g -o oracle -c FLASE -op oracle -b /oracle/app -s ZHS16GBK## 安装目录记录在/soft目录下 OracleAllSilent.*log,在文末展示安装目录
2. 数据库登录验证
[root@s11g ~]# su - oracleLast login: Tue Dec 7 21:27:10 CST 2021 on pts/1## 第一种验证方式[oracle@s11g:/home/oracle]$ sasSQL> select instance_name,status from v$instance;INSTANCE_NAME STATUS---------------- ------------oracle OPEN## 第二种验证方式 sysdba登录sqlplus / as sysdbasqlplus / as sysdba@ORCL## 第三种连接方式(远程访问)./sqlplus SCOTT/oracle@82.156.213.133:1521/oracle
3. 其他操作
创建新用户以及数据
## Oracle数据库,创建测试表[oracle@s11g:/home/oracle]$ sqlplus / as sysdbaSQL> drop user scott cascade;SQL> create user scott identified by oracle;SQL> grant dba to scott;SQL> conn scott/oracle## 第一批数据SQL> create table scott.T1( name VARCHAR2(20), age INTEGER, sex VARCHAR2(3), grade INTEGER);insert into scott.t1 values('丽丽',18,'女',1000);commit;## 第二批数据create table TCE(ID CHAR(10),CREATE_DATE DATE );insert into TCE VALUES(1, to_date('2019-2-26 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));insert into TCE VALUES(2, to_date('2019-2-27 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));insert into TCE VALUES(3, to_date('2019-2-28 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));insert into TCE VALUES(4, to_date('2019-3-1 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));insert into TCE VALUES(5, to_date(to_char('2021-12-05 11:14:25' , 'yyyy-mm-dd hh24:mi:ss')));insert into TCE VALUES(6, to_date('2021-12-06 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));insert into TCE VALUES(7, to_date('2021-12-07 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));insert into TCE VALUES(8, to_date('2021-12-08 11:14:25' , 'yyyy-mm-dd hh24:mi:ss')); insert into TCE VALUES(9, to_date('2021-12-09 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));insert into TCE VALUES(10, to_date('2021-12-10 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));insert into TCE VALUES(11, to_date('2021-12-11 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));select * from TCE where CREATE_DATE > to_date(to_char('2019-2-27 11:14:25' , 'yyyy-mm-dd hh24:mi:ss'));
环境变量
[oracle@s11g:/lib64]$ vim ~/.bash_profile################OracleBegin#########################umask 022export TMP=/tmpexport TMPDIR=$TMPexport NLS_LANG=AMERICAN_AMERICA.ZHS16GBK #AL32UTF8,ZHS16GBKexport ORACLE_BASE=/oracle/app/oracleexport ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbexport ORACLE_HOSTNAME=s11gexport ORACLE_TERM=xtermexport TNS_ADMIN=$ORACLE_HOME/network/adminexport LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/libexport ORACLE_SID=oracleexport PATH=/usr/sbin:$PATHexport PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATHalias sas='sqlplus / as sysdba'alias alert='tail -500f $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace/alert_$ORACLE_SID.log|more'export PS1="[`whoami`@`hostname`:"'$PWD]$ '################OracleEnd###########################
4. 引用
https://blog.csdn.net/m0_50546016/article/details/116503394
5. 资料
链接:https://pan.baidu.com/s/1XP-ZCBfBxOWk_ShMVf0W8A
提取码:omba
--来自百度网盘超级会员V3的分享