bay-- mounting _Oracle 12C- single instance -Centos7 -DG.txt

 

User and password:

root/bayaim
bayaim/064286BAIbay
oracle/oracle
SID:orcl
sys/oracle
system/oracle
mpay/mpay
dx/dx

---------------------------------------------
Linux installation environment #
export = en_US LANG
systemctl firewalld.service sTOP (stop the firewall, which is CentOS7 command)
systemctl restart to restart the network card 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 to delete, and then change it 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:>>>>>>>>

With the main library:

sqlplus / SYSDBA AS
SELECT log_mode, force_logging from V $ Database;
if necessary to close the non-archive database to modify
the shutdown immediate
Startup mount
cleanly and then close the database state started to mount
ALTER Database ARCHIVELOG;
ALTER Database Force the logging;
SELECT log_mode, from V $ force_logging Database;
Archive log List

Change the archive directory
!
Mkdir / u01 / oradata / Prod / ARCHIVELOG
LS the -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

Application Note:
orapwd command is used to create the password file, so you need to understand when you need the password file, execute the following command to view

-------------------------------------------------------------------------------------------

Find the location of a file under linux methods
find / -name tnsnames.ora

Also can locate to find
locate tnsnames.ora

-------------------------------------------------- -----------------------------------------
the pfile file, the password file and device control file transfer to 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

After creation, the database needs to restart, the new password file to take effect.
------------------------- >>>>>>>>>>>>>>>>>>>>>>>> >>>>>>

Found the problem:

In the above, since in the construction orapw password file, set entries is 2, so the password file can be stored in two records, the last one will be overwritten.
test to add the final surface, so passwords existed at the time.
strings orapwstudy $
] \ [the Z-
ORACLE Remote Password File
INTERNAL
D0EECC16A54101ED
B898A7F877F295DD
B0BE7F5D1FD7439A
the TEST
7A0F2B316C212D67
F15C7D7DFC8C7D52


This is Linux or reinstall the openssh-server reload caused to execute the following command
ssh-keygen -R 10.10.10.14
the IP into the server you want to connect on it


Action: Perform executed on the host scp command:

vi ~/.ssh/known_hosts

IP 172.16.103.176 can delete the row.

When this phenomenon after deleting the virtual machine to re-establish particularly evident
if the original host already exists because of a known_hosts, and need to be updated.

 

 

[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

----------------------------------------------------------------------


The top few lines removed, and then marked above all prod into standby

Note db_name do not modify the value of 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

there 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


================================================== ==================================
the Startup nomount initstandby.ora error because the version number inside input errors:


[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 error: reason open firewall:
[@ wwdb1 the Oracle ADMIN] $ tnsping STANDBY

A host server finally found a firewall has been closed, and the host B is not turned off the firewall perform the following operations
all normal off the firewall.

=============== configured standby database listener and static service name
>>> bayaim8.0 ------ install 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 database configuration come to an end and return to the configuration repository prod

[oracle@bay224 admin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/network/admin

========================= configuration database 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


Reported this wrong, in fact, Baidu began to gab faded. . .

[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 database configuration parameters
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;


There are three need to restart to take effect parameters are also provided about the
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;
the shutdown immediate

startup

-------------------------------------------------

Backup prod library

[oracle@prod db]$ mkdir -p /bai/backupset

Creating a backup directory
to log in to start the backup 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;
}

 

Transmitting the backup set to the standby directory under the / u01 directory
Exit
SCP -R & lt / Bai / BACKUPSET / * standby: / Bai / BACKUPSET /

You can check on STANDBY
LS the -l / u01

[oracle@prod backupset]$ scp -r /bai/backupset/* standby:/bai/backupset/
oracle@standby's password:
-----------------------------------------------------------------

Start cloning standby database, running on 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

Resolution: The password file, errors
------------------------------------------- -----------------
start cloning standby database, run [Rego] on Prod
RMAN target / Auxiliary SYS / standby Oracle @
Duplicate for standby target from Active database database Nofilenamecheck dorecover;

 

Start cloning standby database, running on 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;
}

In this case: standby on:

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/bay214/control01.ctl
/u01/app/oracle/fast_recovery_area/bay214/control02.ctl

Whether complete directory inquiries standby, otherwise it is impossible to establish controlfile
restore the standby database!

============================ =================== configure the standby database ===========


Query standby state library
select status from v $ instance;

Now to mount the database state
to create a standby database log backup

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;

 

Are the same as the primary database log size and 50M, a set ratio of the number of multiple primary library
switches prod several logs repository
Exit
sqlplus / AS SYSDBA
SET LINESIZE 300;
SET pageSize 300;
Show Parameter dest_1;
ALTER System Switch logfile;
/
/


Check to see if there is in the standby database archive log of
Exit
LS the -l / Arch

In execution from the library:

Logs can be transmitted on ok!
Preparation of application execution log database synchronization statement runs physical DG
sqlplus / AS SYSDBA
ALTER STANDBY Managed Database Database Recover the using the disconnect from the session Current logfile;


Because of standby redo log, so you can add using current logfile statement, real-time application
select sequence #, applied from v $ archived_log where applied = 'YES' order by sequence #;

yes Description Log sync

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


Data has been synchronized, DG physical build success!
-------------------------------------------------- --- >>>>>>>>>>>>>>>>

At this time standby:
a look at the open state of the database
conn / AS sysdba
the SELECT open_mode from v $ Database;

READ ONLY

At this point prod:

READ WRITE

alter database recover managed standby database using current logfile disconnect from session;

select open_mode from v$database;

After starting data synchronization statement, the database and into a mounted state
Note: When the test data synchronization Do not use the sys user, or may not be synchronized, where tests are used scott users

SQL> SELECT MESSAGE FROM V$DATAGUARD_STATUS;

-------------------------------------------------- -------------------------
complete a start-stop:

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>

================================================== ==================================
the Startup nomount initstandby.ora error because the version number inside input errors:

 

Guess you like

Origin www.cnblogs.com/bayaim/p/11120122.html