Oracle 用脚本安装第二个数据库
- 安装第二个数据库:
vi .bash_profier
ORACLE_SID=prod2
- 临时环境变量:
$export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
$export ORACLE_SID=prod2
- 创建第二个数据库文件目录:
$mkdir -p /u01/app/oracle/oradata/prod2
- 创建sys用户密码文件:
$cd /u01/app/oracle/product/11.2.0/db_1/dbs
$orapwd file=orapwprod2 password=oracle
- 创建一个可读参数文件:
$vi initprod2.ora
添加:
DB_NAME=prod2
sga_target=500M
control_files='/u01/app/oracle/oradata/prod2/control01.ctl'
- 打开实例进入nomount模式,创建数据库系统proc,view ……:
SQL> sqlplus / as sysdba
SQL> startup nomount;
SQL> create spfile from pfile;
SQL> shutdown immediate;
SQL> startup nomount;
SQL> alter system set db_create_file_dest='/u01/app/oracle/oradata/prod2';
SQL> create database character set AL32UTF8 extent management local;
SQL> @?/rdbms/admin/catalog.sql;
SQL> @?/rdbms/admin/catproc.sql;
SQL> alter user system identified by oracle account unlock;
SQL> conn system/oracle
SQL> @?/sqlplus/admin/pupbld.sql;
- 验证实例:
SQL> show parameter name; NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string prod2
db_unique_name string prod2
global_names boolean FALSE
instance_name string prod2
lock_name_space string
log_file_name_convert string
service_names string prod2
- 多个数据库切换:. oraenv
[oracle@test ~]$ . oraenv
ORACLE_SID = [prod2] ? prod1
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 is /u01/app/oracle
- 当再切入第二的环境变量的时候的,会无法自动识别oracle家目录,需手动输入地址,解决方法如下:
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database. # A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
prod1:/u01/app/oracle/product/11.2.0/db_1:Y
prod2:/u01/app/oracle/product/11.2.0/db_1:Y
- 演示1:
[oracle@test ~]$ ps -ef|grep smon
oracle 11062 1 0 00:25 ? 00:00:00 ora_smon_prod2
oracle 12799 12285 0 02:12 pts/2 00:00:00 grep smon
[oracle@test ~]$ dbshut
ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener
Usage: /u01/app/oracle/product/11.2.0/db_1/bin/dbshut ORACLE_HOME
Processing Database instance "prod1": log file /u01/app/oracle/product/11.2.0/db_1/shutdown.log
Processing Database instance "prod2": log file /u01/app/oracle/product/11.2.0/db_1/shutdown.log
[oracle@test ~]$ ps -ef|grep smon
\oracle 12955 12285 0 02:12 pts/2 00:00:00 grep smon
- 演示2:
[oracle@test ~]$ . oraenv
ORACLE_SID = [prod2] ? prod1
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 is /u01/app/oracle
[oracle@test ~]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/product/11.2.0/db_1/bin/dbstart ORACLE_HOME
Processing Database instance "prod1": log file /u01/app/oracle/product/11.2.0/db_1/startup.log
Processing Database instance "prod2": log file /u01/app/oracle/product/11.2.0/db_1/startup.log
[oracle@test ~]$ ps -ef|grep smon
oracle 13130 1 0 02:13 ? 00:00:00 ora_smon_prod1
oracle 13239 1 0 02:13 ? 00:00:00 ora_smon_prod2
oracle 13390 12285 0 02:14 pts/2 00:00:00 grep smon
[oracle@test ~]$ dbshut
ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener
Usage: /u01/app/oracle/product/11.2.0/db_1/bin/dbshut ORACLE_HOME
Processing Database instance "prod1": log file /u01/app/oracle/product/11.2.0/db_1/shutdown.log
Processing Database instance "prod2": log file /u01/app/oracle/product/11.2.0/db_1/shutdown.log
[oracle@test ~]$ ps -ef|grep smon
oracle 13550 12285 0 02:14 pts/2 00:00:00 grep smon
- 监听器没有受到快捷启停命令的影响:
[oracle@test ~]$ ps -ef|grep lsnr
oracle 13609 1 0 02:18 ? 00:00:00 /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr LISTENER -inherit
oracle 13621 12285 0 02:19 pts/2 00:00:00 grep lsnr
Oracle 用脚本安装第二个数据库的更多相关文章
- oracle slient静默安装并配置数据库及仅安装数据库不配置数据库shell
<1,>仅安装数据库软件不配置数据库 ./x86oracle.sh /ruiy/ocr/DBSoftware/app/oracle /ruiy/ocr/DBSoftware/app/ora ...
- 使用Oracle安装账户登录数据库
如果Linux或Unix平台,安装了Oracle,而且有root账号,则使用“su Oracle安装账户”的方式,sqlplus登录到数据库,这种方式是最可靠的.正如@dbsnake所说,”主要是Or ...
- Windows下Oracle 11g安装以及创建数据库
安装数据库 事实上Oracle安装 1.安装准备 Oracle的安装包下载以后是两个压缩包,同时选中两个压缩包右击进行解压 2.解压完成如下图所示 3.双击 setup.exe 文件进行安装,会弹出以 ...
- mysql oracle静默 一键安装脚本
pre-read; 为了达到一键搞定的目的!现Ruiy简单做如下几小条规定 如果你想这么一键来搞定请君莫要违背约束! 1. 下载 `二进制` mysql软件介质版本不限,二进制包务必,源码及rpm ...
- 基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:3.安装Oracle RAC-3.5.安装oracle11gr2 database 软件与创建数据库
3.5.安装oracle11gr2 database 软件与创建数据库 3.5.1.安装Oracle 11gr2 Database 以oracle 用户登录到节点一,切换到软件安装目录,执行安装. 在 ...
- Oracle数据库(一)--Oracle简介及安装
一.Oracle简介 Oracle是美国一家著名的软件公司,也是世界上排名前三的软件公司(微软,Oracle,Adobe).Oracle数据库是一个大型的关系型数据库,在一些大型的企业之中使用的会比较 ...
- RedHat系列软件管理(第二版) --脚本安装
RedHat系列软件管理 --脚本安装 一.解压缩 tar -zxvf webmin-1.700.tar.gz 二.进入相关目录 cd webmin-1.700 三.如果此时执行./configure ...
- Oracle数据库学习(一):虚拟机下Oracle Linux的安装与配置
这篇博文主要以图片的形式讲述Oracle Linux在虚拟机下的安装与配置 一.前期虚拟机安装ISO文件的配置 1.创建新的虚拟机 2.选择“自定义(高级)”选项,下一步,默认“虚拟机硬件兼容性”或选 ...
- Linux平台 Oracle 18c RAC安装
Linux平台 Oracle 18c RAC安装Part1:准备工作 2018-08-04 22:20 by AlfredZhao, 1065 阅读, 0 评论, 收藏, 编辑 一.实施前期准备工作 ...
随机推荐
- 使用fiddler的过滤条件
使用fiddler抓包的时候经常一下子显示很多的记录,看的眼花缭乱,需要这时候需要使用过滤条件来帮助你,一般常用的有三种过滤条件: 1.域名过滤,只显示特定域名的记录: *.baidu.com表示所有 ...
- BZOJ2299 HAOI2011向量(数论)
设最后的组成为x=x0a+x1b,y=y0a+y1b.那么容易发现x0和y0奇偶性相同.x1和y1奇偶性相同.于是考虑奇偶两种情况,问题就变为是否存在x和y使ax+by=c,那么其充要条件是gcd(a ...
- 题解 P1184 【高手之在一起】
好!机会来了! 依评论区的要求,小金羊献上STLset<string>的题解. 当然不会告诉你map<string,bool>我根本不会用 所以,有什么内置的成员函数救救孩子? ...
- win10用vncviewer远程登陆ubuntu桌面
一:安装Ubuntu的服务端桌面环境 # 安装xrdpsudo apt-get install xrdp # 安装xfce4sudo apt-get updatesudo apt-get instal ...
- Fire Net HDU - 1045(二分匹配)
把每一列中相邻的 . 缩为一个点 作为二分图的左边 把每一行中相邻的 . 缩为一个点 作为二分图的右边 然后求最大匹配即可 这题用匈牙利足够了...然而..我用了hk...有点大材小用的感觉// ...
- 异步查询json传日期格式到前台,变成了时间戳的格式
问题: 使用mybatis 查询mysql数据库,其中一个日期格式的字段,由异步查询使用 json传递到前台,变成了时间戳,而不是日期格式了.如何使查询出的日期展示成日期格式呢 解决办法: 1.尝试使 ...
- stm32 修改工作频率
@2018-5-11 10:04:22 修改外部晶振大小 stm32f4xx系列是在文件<stm32f4xx.h>中的宏定义 #define HSE_VALUE (uint32_t)800 ...
- 洛谷 P1344 [USACO4.4]追查坏牛奶Pollutant Control 解题报告
P1344 [USACO4.4]追查坏牛奶Pollutant Control 题目描述 你第一天接手三鹿牛奶公司就发生了一件倒霉的事情:公司不小心发送了一批有三聚氰胺的牛奶.很不幸,你发现这件事的时候 ...
- 【bzoj2440】 中山市选2011—完全平方数
http://www.lydsy.com/JudgeOnline/problem.php?id=2440 (题目链接) 题意 求第K个不含有完全平方因子的数 Solution 没想到莫比乌斯还可以用来 ...
- (转)eclipse设置默认编码格式为UTF-8
设置 需要设置的几处地方为: Window->Preferences->General ->Content Type->Text->JSP 最下面设置为UTF-8,可以设 ...