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 评论, 收藏, 编辑 一.实施前期准备工作 ...
随机推荐
- web项目部署在不同环境中需要修改配置文件的解决方法
web项目部署中存在的配置文件问题: web项目以war包的形式,部署在tomcat中,同时项目需要访问一些其他的东东,例如访问数据库,调用别的项目的API.在开发中,这些需要访问的外部地址通常以配置 ...
- node模块加载机制。
- js & option keycode
js & option keycode js get option keycode https://keycode.info/ option https://github.com/wesbos ...
- wireshark系列之wireshark过滤器
一:过滤器 使用wireshark工具抓包,如果使用默认配置,会得到大量的数据,所以我们就很难找到我们要分析的封包数据.所以使用wireshark过滤器就显得尤为重要. wireshark过滤器分为两 ...
- 【题解】Friends
题目描述 有三个好朋友喜欢在一起玩游戏,A君写下一个字符串S,B君将其复制一遍得到T,C君在T的任意位置(包括首尾)插入一个字符得到U.现在你得到了U,请你找出S. 输入输出格式 输入格式 第一行,一 ...
- 安装及调试 Mavem Web
一 使用Mavem eclipse菜单栏,找到file-->new -->other 然后找到Maven Project 然后next. 接着,选择maven-archetype-web ...
- Kangax 的 ES7 兼容性表格
Kangax 的 ES7 兼容性表格 https://kangax.github.io/compat-table/es2016plus/ Sort by Engine type ...
- MT【177】三个乘积和
对任意 2 个 1,2,3,4,5,6 的全排列 $(a_1,a_2,a_3,a_4,a_5,a_6)$ 和 $(b_1,b_2,b_3,b_4,b_5,b_6)$,求$\displaystyle S ...
- 【刷题】LOJ 2818 「eJOI2018」循环排序
题目描述 本题译自 eJOI2018 Problem F「Cycle Sort」 给定一个长为 \(n\) 的数列 \(\{a_i\}\) ,你可以多次进行如下操作: 选定 \(k\) 个不同的下标 ...
- 洛谷 P4070 [SDOI2016]生成魔咒 解题报告
P4070 [SDOI2016]生成魔咒 题目描述 魔咒串由许多魔咒字符组成,魔咒字符可以用数字表示.例如可以将魔咒字符 \(1\).\(2\) 拼凑起来形成一个魔咒串 \([1,2]\). 一个魔咒 ...