大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
hostnamectl set-hostname DG
vim /etc/sysconfig/network-scripts/ifcfg-enp0s3
为桥西等地区用户提供了全套网页设计制作服务,及桥西网站建设行业解决方案。主营业务为做网站、成都网站建设、桥西网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
重启网卡
systemctl restart network
测试:
nslookup www.yunxiaochong.com
重启生效
(1)执行env.sh. 配置环境,脚本如下:
参考: http://blog.itpub.net/69915315/viewspace-2643785/
(2)执行rpm.sh . 安装依赖包,脚本如下:
参考: http://blog.itpub.net/69915315/viewspace-2643785/
参考: http://blog.itpub.net/69915315/viewspace-2643790
单节点执行即可,对应主库共享磁盘组: DATA, GRIDG. 这里只是为了一致,没有强制要求一样。
参考 : http://blog.itpub.net/69915315/viewspace-2643299/
分配配置 oracle grid 两个用户的远程桌面。
四、安装grid
(1)解压安装包:
unzip linuxamd64_12102_grid_1of2.zip unzip linuxamd64_12102_grid_2of2.zip
(2) 将解压后的安装包拷贝到 /home/grid 目录下
mv grid /home/grid/
(3) 进入grid的远程桌面,进入安装....
(4) 相关问题
swap size 问题:
注释: 上面少写了一个0,空间还是不够,后面有加了一个。
修改/etc/fstab文件,在文件最后添加:
/opt/image/swap swap swap defaults 0 0
安装遗漏包
yum install libaio-devel*
忽略pdksh
图形界面执行脚本报错,通过命令执行,依然报错后,再直接提示的命令。
unzip linuxamd64_12102_database_1of2.zip
unzip linuxamd64_12102_database_2of2.zip
mv database /home/oracle/
六、配置共享磁盘组
此处是grid_home下的监听,注意将文件内容中的grid_home 修改成 oracle_home路径
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.150)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) SID_LIST_LISTENER = ( SID_LIST = (SID_DESC = (GLOBAL_DBNAME = yun) #CDB #(ORACLE_HOME = /u01/app/11.2/grid) (ORACLE_HOME = /u01/app/oracle/product/11.2/db_1) (SID_NAME = YUNDG) ) (SID_DESC = (GLOBAL_DBNAME = xiaochong) #PDB #(ORACLE_HOME = /u01/app/11.2/grid) (ORACLE_HOME = /u01/app/oracle/product/11.2/db_1) (SID_NAME = YUNDG) ) )
分别在主库的rac四个节点和从库的一个节点上对 tnsnames.ora 进行配置
文件路径:
/u01/app/oracle/product/11.2/db_1/network/admin/tnsnames.ora
##主库 YUN = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = www.yunxiaochong.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = yun) ) ) ##从库 YUNDG = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.8)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = yun)
在rac中一个节点创建密码文件:
orapwd password='Oracle' file=orapwyun1 entries=20;
然后,将其拷贝到其它三个节点和dg节点,将名称改成orapw+各节点的实例名。 如orapwyun2 orapwYUNDG
scp orapwyun1 oracle@rac02:/u01/app/oracle/product/11.2/db_1/dbs/
注意:不要分别在不同节点上创建密码文件,不然会报 密码文件不一致问题。
(1)查看主库的数据文件,日志文件,控制文件路径
(2)从库,用grid用户,进入asmcmd,建立相关目录
控制文件目录:
同样,建立 +GRIDDG/YUM/CONTROLFILE 目录。
建立日志文件目录:
+DATA/YUN/ONLINELOG
+GRIDDG/YUN/ONLINELOG
建立数据文件目录:
+DATA/YUN/DATAFILE
+DATA/YUN/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE
+DATA/YUN/88E906E617243D8FE0536E38A8C04CBC/DATAFILE
+DATA/YUN/88E906E617243D8FE0536E38A8C04CBC/TEMPFILE
从主库中创建pfile (create pfile from spfile),修改后,拷贝到从库
路径: /u01/app/oracle/product/11.2/db_1/dbs/initYUNDG.ora
内容如下:
*.audit_sys_operations=FALSE *.audit_trail='NONE' *.compatible='12.1.0.2.0' *.control_files='/u01/app/oracle/oradate/controlfile/control01.ctl' *.db_block_size=8192 *.db_create_file_dest='+DATA' *.db_name='yun' *.db_unique_name='yundg' #*.db_recovery_file_dest='+DATA/' #*.db_recovery_file_dest_size=5535m *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=yunXDB)' *.enable_pluggable_database=true *.fal_client='YUNDG' *.fal_server='YUN' *.log_archive_config='dg_config=(YUNDG,YUN)' *.log_archive_dest_1='location=+DATA/YUN/ARCHIVELOG valid_for=(all_logfiles,all_roles) db_unique_name=yundg' *.log_archive_dest_2='service=YUN LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=yun' *.open_cursors=1000 *.pga_aggregate_target=681m *.processes=300 *.remote_login_passwordfile='exclusive' *.sga_target=2043m *.standby_file_management='AUTO' ##下面两个参数注释掉,因为我们在从库配置了跟主库一样的目录结构。 #*.log_file_name_convert='+DATA/YUN/onlinelog','+DATA/YUN/onlinelog' #*.db_file_name_convert='+DATA/YUN/datafile','+DATA/YUN/datafile'
这里主要是修改参数:
alter system set log_archive_dest_2='service=YUNDG LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=yundg' scope=both sid='*'; alter system set log_archive_config='dg_config=(YUN,YUNDG)' scope=both sid='*'; alter system set standby_file_management=auto scope=both sid='*'; alter system set fal_client=YUN scope=both sid='*'; alter system set fal_server=YUNDG scope=both sid='*';
设置force logging
ALTER DATABASE FORCE LOGGING;
rman target sys/Oracle01@YUN auxiliary sys/Oracle01@YUNDG
duplicate target database for standby from active database nofilenamecheck dorecover;
错误记录1:
channel ORA_DISK_1: SID=60 instance=yun1 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/28/2019 13:47:31
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 05/28/2019 13:47:29
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12543: TNS:destination host unreachable
ORA-17629: Cannot connect to the remote database server
_______________________________________________________________________________________
主要是主库不能通过tnsname,ora连接到从库,确保 sqlplus sys/Oracle01@YUNDG as sysdba 能够连接
错误记录2:
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service YUN
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +DATA
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/28/2019 14:04:07
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
ORA-19845: error in backupDatafile while communicating with remote database server
ORA-17628: Oracle error 19602 returned by remote Oracle server
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
ORA-19660: some files in the backup set could not be verified
ORA-19661: datafile 1 could not be verified
ORA-19845: error in backupDatafile while communicating with remote database server
ORA-17628: Oracle error 19602 returned by remote Oracle server
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
_______________________________________________________________________________________
主要是主库没有归档,开启归档即可
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 26
Current log sequence 27
在从库上创建standby log
alter database add standby logfile thread 1 group 9 size 50m,group 10 size 50m,group 11 size 50m; alter database add standby logfile thread 2 group 12 size 50m,group 13 size 50m,group 14 size 50m; alter database add standby logfile thread 3 group 15 size 50m,group 16 size 50m,group 17 size 50m; alter database add standby logfile thread 4 group 18 size 50m,group 19 size 50m,group 20 size 50m;
如果是要主从切换,在主库上也要建立standby red log。
alter database open;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
创建用户,创建表,插入数据,从库同步能查询到数据。