bay——安装_Oracle 12C-单实例-Centos7 -DG.txt
用户和密码:
root/bayaim
bayaim/064286BAIbay
oracle/oracle
SID:orcl
sys/oracle
system/oracle
mpay/mpay
dx/dx
---------------------------------------------
linux #安装环境
export LANG=en_US
systemctl stop firewalld.service (停止防火墙,这是CentOS7的命令)
systemctl restart network //重启网卡-----------
vi /etc/yum.repos.d/rhel-source.repo
mount /dev/cdrom /mnt
cd /etc/sysconfig/network-scripts
[root@wwdb2 network-scripts]# cp ifcfg-eth0 ifcfg-eth0.bak
[root@wwdb2 network-scripts]# vi ifcfg-eth0.bak
把 HWADDR 删除掉,然后改一下 IPADDR
HWADDR=78:2B:CB:4A:15:93
[root@wwdb2 network-scripts]# mv ifcfg-eth0.bak ifcfg-eth0
mv: overwrite `ifcfg-eth0'? y
[root@wwdb2 network-scripts]# service network restart
[root@wwdb2 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 78:2B:CB:4A:15:93
inet addr:10.10.10.14 Bcast:10.10.10.255 Mask:255.255.255.0
inet6 addr: fe80::7a2b:cbff:fe4a:1593/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:397 errors:0 dropped:0 overruns:0 frame:0
TX packets:223 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:50334 (49.1 KiB) TX bytes:28565 (27.8 KiB)
Interrupt:114 Memory:d6000000-d6012800
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:572939 errors:0 dropped:0 overruns:0 frame:0
TX packets:572939 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:215517488 (205.5 MiB) TX bytes:215517488 (205.5 MiB)
-----------------------------------------------------------
[root@localhost bai]# vi /etc/hosts
添加:
10.20.100.21 bay214
10.20.100.22 bay224
[root@wwdb2 ~]# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=wwdb2
[root@localhost bai]# hostname prodb
[root@localhost bai]# hostname
prodb
[root@localhost bai]# cat /etc/hostname
pordb
[root@localhost network-scripts]# cd /etc/sysconfig/network-scripts
[root@localhost network-scripts]# cp ifcfg-bond-bond0 ifcfg-bond-bond0.bak
[root@localhost network-scripts]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 114.114.114.114
----------------------------------------------------------------
>>>bayaim10.0------配置oracle:>>>>>>>>
配合主库:
sqlplus / as sysdba
select log_mode,force_logging from v$database;
如果是非归档就要关闭数据库修改
shutdown immediate
startup mount
干净地关闭数据库再启动到mount状态
alter database archivelog;
alter database force logging;
select log_mode,force_logging from v$database;
archive log list
更改归档目录
!
mkdir /u01/oradata/prod/archivelog
ls -l /u01/oradata/prod
exit
alter system set log_archive_dest_1='location=/u01/oradata/prod/archivelog';
archive log list
alter database open;
>>>bayaim10.0------配置oracle:>>>>>>>>
1.0 创建pfile
create pfile from spfile;
[oracle@pordb ~]$ cd $ORACLE_HOME\dbs
[oracle@pordb dbs]$ pwd
/u01/app/oracle/11g/dbs
SQL> alter database create standby controlfile as '/u01/app/oracle/product/11.2.0/db_1/dbs/prodb.ctl';
[oracle@localhost ~]$orapwd file=$ORACLE_HOME/dbs/orapwprodb password=oracle entries=3
应用说明:
orapwd命令是用来创建口令文件的,所以需要明白什么时候需要这个口令文件,执行下列命令查看
-------------------------------------------------------------------------------------------
linux下查找某个文件位置的方法
find / -name tnsnames.ora
还可以用locate 来查找
locate tnsnames.ora
-------------------------------------------------------------------------------------------
把pfile文件、口令文件和备控制文件传输到standby
exit
cd /u01/app/oracle/11g/dbs
ls -lrt
scp orapwbay214 bay224:/u01/app/oracle/product/11.2.0/db_1/dbs
scp initbay214.ora bay224:/u01/app/oracle/product/11.2.0/db_1/dbs
scp prodb.ctl bay224:/u01/app/oracle/product/11.2.0/db_1/dbs
[oracle@pordb dbs]$ pwd
/u01/app/oracle/11g/dbs
[root@bay214 ~]# find / -name *control*.ctl
/u01/app/oracle/oradata/bay214/control01.ctl
/u01/app/oracle/fast_recovery_area/bay214/control02.ctl
[oracle@standby dbs]$ cp prodb.ctl /u01/app/oracle/oradata/bay214/control01.ctl
[oracle@standby dbs]$ mkdir -p /u01/app/oracle/fast_recovery_area/bay214
[oracle@standby dbs]$ cp prodb.ctl /u01/app/oracle/fast_recovery_area/bay214/control02.ctl
创建完后,数据库需要重启动,新的口令文件才能生效。
------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
发现问题:
在上面,由于在建 orapw 口令文件时,设定的 entries 值为2 ,故口令文件只能存放两条的记录,最后一条会被覆盖。
test 为最后面添加的,所以口令时存在的。
$strings orapwstudy
]\[Z
ORACLE Remote Password file
INTERNAL
D0EECC16A54101ED
B898A7F877F295DD
B0BE7F5D1FD7439A
TEST
7A0F2B316C212D67
F15C7D7DFC8C7D52
这是Linux重装或则openssh-server重装引起的,执行以下命令即可
ssh-keygen -R 10.10.10.14
把IP换成你要连的服务器就可以
操作:在执行scp命令的主机上执行:
vi ~/.ssh/known_hosts
删除IP为172.16.103.176 的行即可。
该现象在虚拟机删除之后重新建立的时候尤其明显,
要是因为原始主机已经存了一份了known_hosts了,需要更新。
[oracle@wwdb2 ~]$ env | grep ORA
[oracle@wwdb2 ~]$ vi .bash_profile
[oracle@wwdb2 ~]$ source .bash_profile
[oracle@standby dbs]$ mv orapwprodb orapwstandby
[oracle@standby dbs]$ mv initprodb.ora initstandby.ora
[oracle@standby dbs]$
#chown -R oracle:oinstall /oradata1
#chmod 775 /oradata1
[oracle@wwdb2 oradata1]$ mkdir standby
----------------------------------------------------------------------
把最上面几行去掉,然后把上面标注的prod都改成standby
注意db_name的prod值不要修改
[oracle@pordb prodb]$ pwd
/u01/app/oracle/oradata/prodb
mkdir -p /u01/app/oracle/oradata/bay214
mkdir -p /u01/app/oracle/fast_recovery_area
mkdir -p /u01/app/oracle/admin/bay214/adump
mkdir -p /u01/app/oracle/admin/bay214/cdump
mkdir -p /u01/app/oracle/admin/bay214/bdump
mkdir -p /u01/app/or-acle/admin/bay214/dpdump
mkdir -p /u01/app/oracle/admin/bay214/pfile
chown -R oracle:oinstall /u01/
cd /u01/app/oracle/product/11.2.0/db_1/dbs
vi initstandby.ora
添加如下参数:
*.db_unique_name='bay214'
*.db_file_name_convert='/u01/app/oracle/oradata/bay214','/u01/app/oracle/oradata/bay214'
*.log_file_name_convert='/u01/app/oracle/oradata/bay214','/u01/app/oracle/oradata/bay214'
*.log_archive_config='dg_config=(bay214,bay214)'
*.log_archive_dest_1='location=/u01/arch valid_for=(all_logfiles,all_roles) db_unique_name=bay214'
*.log_archive_dest_2='service=bay214 lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=bay214'
*.log_archive_dest_state_1=enable
*.log_archive_dest_state_2=enable
*.log_archive_max_processes=10
*.fal_server=bay214
*.fal_client=bay214
*.standby_file_management=auto
====================================================================================
startup nomount 报错 原因是 initstandby.ora 里面 的版本号输入错误:
[oracle@wwdb2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Oct 16 14:55:28 2014
Copyright (c) 182, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORA-00401: the value for parameter compatible is not supported by this release
SQL> startup nomount
ORACLE instance started.
Total System Global Area 3120562176 bytes
Fixed Size 2929256 bytes
Variable Size 855641496 bytes
Database Buffers 2248146944 bytes
Redo Buffers 13844480 bytes
SQL>
==================================================================================
TNS 报错 :原因是防火墙开着:
[oracle@wwdb1 admin]$ tnsping standby
最后发现是 主机A服务器防火墙已经关闭,而主机B上防火墙没有关闭进行如下操作
防火墙关闭后一切正常。
===============配置standby库的listener和静态服务名
>>>bayaim8.0------安装oracle:>>>>>>>>
#su - oracle
$source .bash_profile
$export DISPLAY=10.20.100.114:0.0
$export LANG=en_US
$xhost +
$xclock
$./runInstaller
netmgr
netca
tnsping prod
env | grep ORA
SQL> create spfile from pfile='?/dbs/initprodb.ora';
File created.
SQL> startup nomount
standby库的配置告一段落,重新回到prod库的配置
[oracle@bay224 admin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/network/admin
=========================配置prod数据库======================
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.13)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = fjflww)))
TNS-12543: TNS:destination host unreachable
报这个错,其实百度又开始瞎扯淡了。。。
[root@standby admin]# service iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
[root@standby admin]# su - oracle
[oracle@standby ~]$
配置prod库参数
sqlplus / as sysdba
alter system set log_archive_config='dg_config=(bay214,bay214)';
alter system set log_archive_dest_1='location=/u01/arch valid_for=(all_logfiles,all_roles) db_unique_name=bay214';
alter system set log_archive_dest_2='service=bay224 lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=bay214';
alter system set log_archive_dest_state_1=enable;
alter system set log_archive_dest_state_2=enable;
alter system set log_archive_max_processes=10;
alter system set fal_server=bay214;
alter system set fal_client=bay214;
alter system set standby_file_management=auto;
set pagesize 450
set linesize 440
show parameter log;
show parameter fal;
还有三需要重启才生效的参数也设置一下
alter system set db_unique_name='bay214' scope=spfile;
alter system set db_file_name_convert='/u01/app/oracle/oradata/bay214','/u01/app/oracle/oradata/bay214' scope=spfile;
alter system set log_file_name_convert='/u01/app/oracle/oradata/bay214','/u01/app/oracle/oradata/bay214' scope=spfile;
shutdown immediate
startup
-------------------------------------------------
备份prod库
[oracle@prod db]$ mkdir -p /bai/backupset
创建了备份目录
登陆到rman开始备份
rman target /
RMAN>
run
{
allocate channel d1 type disk ;
allocate channel d2 type disk ;
allocate channel d3 type disk ;
backup database format '/bai/backupset/%U';
release channel d1;
release channel d2;
release channel d3;
}
把备份集目录传输到standby的/u01目录下
exit
scp -r /bai/backupset/* standby:/bai/backupset/
可以在standby上检查一下
ls -l /u01
[oracle@prod backupset]$ scp -r /bai/backupset/* standby:/bai/backupset/
oracle@standby's password:
-----------------------------------------------------------------
开始克隆standby库,在prod上运行
[oracle@prod backupset]$ rman target / auxiliary sys/oracle@prodbdg
Recovery Manager: Release 11.2.0.1.0 - Production on Sun Nov 29 10:14:13 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: FJFLWW (DBID=3823638492)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04006: error from auxiliary database: ORA-01031: insufficient privileges
解决: 口令文件,错误导致
------------------------------------------------------------
开始克隆standby库,在prod上运行 [ 雷哥 ]
rman target / auxiliary sys/oracle@standby
duplicate target database for standby from active database Nofilenamecheck dorecover;
开始克隆standby库,在prodb上运行
rman target / auxiliary sys/bayaim@bay224
connected to target database: PRODB (DBID=2396898227)
connected to auxiliary database: PRODB (not mounted)
run
{
allocate auxiliary channel d1 type disk;
allocate auxiliary channel d2 type disk;
allocate auxiliary channel d3 type disk;
duplicate target database for standby nofilenamecheck;
release channel d1;
release channel d2;
release channel d3;
}
此时:standby 上:
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/bay214/control01.ctl
/u01/app/oracle/fast_recovery_area/bay214/control02.ctl
查询 standby 上是否目录齐全,否则无法建立controlfile
还原了standby库!
============================配置standby数据库==============================
查询standby库状态
select status from v$instance;
现在数据库为mount状态
创建备库的standby日志
alter database add standby logfile ('/u01/app/oracle/oradata/bay214/standby01.log') size 50m;
alter database add standby logfile ('/u01/app/oracle/oradata/bay214/standby02.log') size 50m;
alter database add standby logfile ('/u01/app/oracle/oradata/bay214/standby03.log') size 50m;
日志大小和主库的一样都是50M,数量比主库多一组
在prod库切换几个日志
exit
sqlplus / as sysdba
set linesize 300;
set pagesize 300;
show parameter dest_1;
alter system switch logfile;
/
/
在standby库查看一下是否有归档日志了
exit
ls -l /arch
在从库上执行:
日志可以传输了就ok!
备库执行日志应用同步语句,开始运行物理DG
sqlplus / as sysdba
alter database recover managed standby database using current logfile disconnect from session;
因为有备重做日志,所以可以加using current logfile语句,实现实时应用
select sequence#, applied from v$archived_log where applied='YES' order by sequence#;
yes说明日志同步了
SQL> create spfile from pfile;
----------------------------------------------------------->>>>>>>>>>>>>>>
验证:
在prod库上执行:
conn scott/tiger
create table t(i int);
insert into t values(1);
commit;
conn / as sysdba
alter system switch logfile;
在standby库上执行:
alter database recover managed standby database cancel;
alter database open;
conn scot/tiger
select * from t;
SQL> select table_name from user_tables;
SQL> select instance_name,status from v$instance;
SQL> alter database recover managed standby database using current logfile disconnect from session;
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY WITH APPLY
数据已经同步,物理DG搭建成功!
----------------------------------------------------->>>>>>>>>>>>>>>>
此时standby :
看一下数据库的open状态
conn / as sysdba
select open_mode from v$database;
READ ONLY
此时prod :
READ WRITE
alter database recover managed standby database using current logfile disconnect from session;
select open_mode from v$database;
启动数据同步语句后,数据库又变为mounted状态
注意:在测试数据同步的时候请不要用sys用户,不然可能同步不了,这里测试都是用scott用户
SQL> SELECT MESSAGE FROM V$DATAGUARD_STATUS;
---------------------------------------------------------------------------
完整的一次启停:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 839282688 bytes
Fixed Size 2217992 bytes
Variable Size 595593208 bytes
Database Buffers 239075328 bytes
Redo Buffers 2396160 bytes
Database mounted.
SQL> alter database open read only;
Database altered.
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
standby OPEN
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Database altered.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY WITH APPLY
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
standby OPEN
SQL> conn scott/tiger
Connected.
SQL> select * from t_5;
I
----------
21212
222
4442
5655
SQL>
====================================================================================
startup nomount 报错 原因是 initstandby.ora 里面 的版本号输入错误:
bay——安装_Oracle 12C-单实例-Centos7 -DG.txt的更多相关文章
- oracle 11g r2 rac到单实例的dg
oracle 11g r2 rac到单实例的dg 1 主备环境说明 rac环境--primary CentOS release 6.5 (Final)hostname rac1 rac2ip 10.* ...
- 1级搭建类103-Oracle 12c 单实例 FS(12.2.0.1+RHEL 7)公开
项目文档引子系列是根据项目原型,制作的测试实验文档,目的是为了提升项目过程中的实际动手能力,打造精品文档AskScuti. 项目文档引子系列目前不对外发布,仅作为博客记录.如学员在实际工作过程中需提前 ...
- Oracle 12c 单实例安装
准备工作 实验环境:Redhat 6.6 Oracle 12c 12.2.0.1 1.官网下载 https://www.oracle.com/technetwork/database/enterp ...
- 在 Oracle Linux 6.5 上安装 Oracle 11g 单实例数据库
Checking the Hardware Requirements 系统必须满足下面最小的硬件要求 Memory Requirements Minimum: 1 GB of RAMRecommend ...
- bay——安装_Oracle 12C-单实例-Centos7.txt
安装Oracle12C 总结笔记 IP:10.20.4.214 ---------------------------------------------用户和密码: root/bayaimbayai ...
- CentOS7 上以 RPM 包方式安装 Oracle 18c 单实例
安装阿里云 YUM 源 https://opsx.alibaba.com/mirror?lang=zh-CN 一.安装Oracle数据库 1.安装 Oracle 预安装 RPM yum -y loca ...
- CentOS7 图形化方式安装 Oracle 18c 单实例
下载 Oracle 数据库,zip 包 https://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.h ...
- bay——安装_Oracle 12C-RAC-Centos7.txt
★★★____★☆★〓〓〓〓→2019年6月26日10:29:42 bayaim-RAC ——搭建第4次VMware vSphere Client6.0 ----------------------- ...
- VM虚拟机下在LINUX上安装ORACLE 11G单实例数据库
1.环境及安装前规划:虚拟机及OS如下 环境:VMware Wordstation ACE版 6.0.2 操作系统:OracleLinux-R5-U8-Server-i386-dvd 3.2G ...
随机推荐
- ubuntu下安装tomcat,shutdown时报错:./catalina.sh:1:eval:/home/xxx/jdk/jre/bin/java:not found
该问题可能导致tomcat启动成功了,但是浏览器输入http://127.0.0.1:8080无法显示tomcat的欢迎界面 打开Tomcat安装目录下的bin文件下的setclasspath.sh, ...
- BOM的补充
1.首先我们要知道BOM是干什么的? BOM和DOM.ES是JavaScript的重要三个组成部分: Bom的核心操作是window:简单来说就是用来操作浏览器的,他是js访问浏览器的接口,它里面封装 ...
- IT兄弟连 HTML5教程 CSS3属性特效 遮罩
CSS遮罩提供一种基于像素级别的,可以控制元素透明度的能力,类似于png24位或png32位中的alpha透明通道的效果.遮罩有三个属性可以设置,分别是mask-image.mask-position ...
- IPFS学习-内容标识符(CIDs)
内容标识符(CIDs) 内容标识符也称为CID,是用于指向IPFS中材料的标签. 它不会指示内容的存储位置,但会根据内容本身形成一种地址. CID简短,无论其基础内容的大小如何. CID基于内容的加密 ...
- WPF 3D球及进阶玩法
在WPF中3D球的构建算法请参考: https://www.cnblogs.com/lonelyxmas/p/9844951.html 好玩以及值得借鉴的Demo: (CSDN下载需要积分,避免你 ...
- centos7下安装客户端rabbitmq9.0
下载目前最新rabbitmq客户端版本: wget https://github.com/alanxz/rabbitmq-c/archive/v0.9.0.tar.gz php扩展 : wget ht ...
- java 网站源码 在线编辑模版 代码编辑器 兼容手机平板PC freemaker 静态引擎
前台: 支持四套模版, 可以在后台切换 系统介绍: 1.网站后台采用主流的 SSM 框架 jsp JSTL,网站后台采用freemaker静态化模版引擎生成html 2.因为是生成的html,所以 ...
- 超宽banner图在版心居中
步骤如下: 1.版心盒子设置相对定位relative 2.banner图设置绝对定位,设置block,清除默认的间距 3.banner图的left设置:left:50%: margin-left:- ...
- ABAP分享三 批量上传数据到内表简单示例
tYPE-POOLS: truxs. DATA: BEGIN OF build, name(10) TYPE c, age(3) TYPE c, sex(2) TYPE c, sp ...
- C lang:programe flow
C language flow Xx_a Introduction C language flow,control program order. Xx_b Foundation satement:fo ...