Chinaunix首页 | 论坛 | 博客
  • 博客访问: 338015
  • 博文数量: 62
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 710
  • 用 户 组: 普通用户
  • 注册时间: 2013-05-14 14:12
个人简介

太懒

文章分类

全部博文(62)

文章存档

2015年(8)

2014年(20)

2013年(34)

我的朋友

分类: Oracle

2014-05-15 18:11:26

oracle 11.2.0.3 32位到64位系统迁移(3)


修改db_name

上次rman恢复完以后,db_name临时用的跟rac环境一样的db_name

顺便修改一遍,参考文档: 



注意事项

文档开头就说的很清楚, 修改dbid会导致以前所有的备份和归档日志全部失效.并且修改完dbid以后必须以resetlog打开数据库
直接影响是重建在线重做日志并且设置sequence为1. 因此,修改完dbid以后最好马上做个全备.

如果只修改db_name不需要用resetlogs打开数据库.这种情况下备份和归档还是可用的.只修改db_name没什么严重后果,受影响的就是oracle的password文件.

还有就是注意 Do not change the DBID or DBNAME of a database if you are using a capture process to capture changes to the database. SeeOracle Streams Concepts and Administration for more information about capture processes.

来源: <>
 

还有一个需要注意,DBNEWID utility 不能用来修改global database names, 如果需要修改的话只能在修改完db_name以后用sql:
 ALTER DATABASE RENAME GLOBAL_NAME TO newname.domain;

首先关闭数据库,然后启动到mount下


SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  296456192 bytes
Fixed Size                  2227784 bytes
Variable Size             109052344 bytes
Database Buffers          180355072 bytes
Redo Buffers                4820992 bytes
Database mounted.
SQL> 

SQL> host
[oracle@my2950 ~]$ dbi
dbilogstrip  dbiprof      dbiproxy     
[oracle@my2950 ~]$ dbi
dbilogstrip  dbiprof      dbiproxy     
[oracle@my2950 ~]$ dbid
bash: dbid: command not found
[oracle@my2950 ~]$ 
[oracle@my2950 ~]$ ni
nice           nid            nidO           nisdomainname  
[oracle@my2950 ~]$ nid -h

DBNEWID: Release 11.2.0.3.0 - Production on Thu May 15 17:16:11 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


NID-00002: Parse error: LRM-00101: unknown parameter name 'h'


Change of database ID failed during validation - database is intact.
DBNEWID - Completed with validation errors.

[oracle@my2950 ~]$


这次是要把db_name修改为 mydb1


[oracle@my2950 ~]$ nid target=sys dbname=mydb1 setname=yes

DBNEWID: Release 11.2.0.3.0 - Production on Thu May 15 17:17:16 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Password: 
Connected to database MOMORAC (DBID=1497461080)

Connected to server version 11.2.0

Control Files in database:
    /u02/oradata/mydb1/control01.ctl
    /u01/app/oracle/product/11.2.3/db_1/dbs/control02.ctl

Change database name of database MOMORAC to MYDB1? (Y/[N]) => y

Proceeding with operation
Changing database name from MOMORAC to MYDB1
    Control File /u02/oradata/mydb1/control01.ctl - modified
    Control File /u01/app/oracle/product/11.2.3/db_1/dbs/control02.ctl - modified
    Datafile /u02/oradata/mydb1/system01.db - wrote new name
    Datafile /u02/oradata/mydb1/sysaux01.db - wrote new name
    Datafile /u02/oradata/mydb1/undotbs101.db - wrote new name
    Datafile /u02/oradata/mydb1/users01.db - wrote new name
    Datafile /u02/oradata/mydb1/zabbix101.db - wrote new name
    Datafile /u02/oradata/mydb1/hyperic0101.db - wrote new name
    Datafile /u02/oradata/mydb1/temp01.db - wrote new name
    Control File /u02/oradata/mydb1/control01.ctl - wrote new name
    Control File /u01/app/oracle/product/11.2.3/db_1/dbs/control02.ctl - wrote new name
    Instance shut down

Database name changed to MYDB1.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.

[oracle@my2950 ~]$ 

分分钟结束

日志记录:

Thu May 15 17:17:29 2014
*** DBNEWID utility started ***
DBNAME will be changed from MOMORAC to new DBNAME of MYDB1
Starting datafile conversion
Datafile conversion complete
Database name changed to MYDB1.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
*** DBNEWID utility finished succesfully ***
Shutting down instance (immediate)
Shutting down instance: further logons disabled
Stopping background process MMNL
Stopping background process MMON
License high water mark = 2
All dispatchers and shared servers shutdown
alter database dismount
Shutting down archive processes
Archiving is disabled
Completed: alter database dismount
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Thu May 15 17:17:35 2014
Stopping background process VKTM
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Thu May 15 17:17:37 2014
Instance shutdown complete


然后关闭数据库-->修改pfile-->创建密码文件-->启动数据库

[oracle@my2950 ~]$ exit
exit

SQL> shutdown immediate
ORA-03135: connection lost contact
SQL> conn / as sysdba
Connected to an idle instance.
SQL> shutdown abort
ORACLE instance shut down.
SQL> exit
Disconnected
[oracle@my2950 ~]$ ps -eaf|grep oracle
root     16932 16865  0 09:10 pts/0    00:00:00 su - oracle
oracle   16933 16932  0 09:10 pts/0    00:00:00 -bash
root     17726  5313  0 10:03 ?        00:00:00 sshd: oracle [priv]
oracle   17728 17726  0 10:03 ?        00:00:00 sshd: oracle@notty
oracle   17729 17728  0 10:03 ?        00:00:00 /usr/libexec/openssh/sftp-server
root     22713 22691  0 16:00 pts/1    00:00:00 su - oracle
oracle   22714 22713  0 16:00 pts/1    00:00:00 -bash
oracle   23686 22714  0 17:15 pts/1    00:00:00 tail -f /u01/app/oracle/diag/rdbms/momorac/momorac/trace/alert_momorac.log
oracle   23734 16933  0 17:19 pts/0    00:00:00 ps -eaf
oracle   23735 16933  0 17:19 pts/0    00:00:00 grep oracle
[oracle@my2950 ~]$
[oracle@my2950 ~]$ cd /u01/app/oracle/product/11.2.3/db_1/dbs/
[oracle@my2950 dbs]$ pd
-bash: pd: command not found
[oracle@my2950 dbs]$ pwd
/u01/app/oracle/product/11.2.3/db_1/dbs
[oracle@my2950 dbs]$ ls
control02.ctl   hc_mydb1.dat      initmydb11.ora  initmydb1.ora.orig  lkMOMORAC
hc_momorac.dat  initmomorac.ora@  initmydb1.ora   init.ora.orig
[oracle@my2950 dbs]$ 
[oracle@my2950 dbs]$ ll
total 18476
-rw-r----- 1 oracle dba 18890752 May 15 17:17 control02.ctl
-rw-rw---- 1 oracle dba     1544 May 15 17:17 hc_momorac.dat
-rw-rw---- 1 oracle dba     1544 May 14 14:52 hc_mydb1.dat
lrwxrwxrwx 1 oracle dba       13 May 15 10:43 initmomorac.ora -> initmydb1.ora
-rw-r--r-- 1 oracle dba       14 May 14 11:51 initmydb11.ora
-rw-r--r-- 1 oracle dba     2257 May 14 14:58 initmydb1.ora
-rw-r--r-- 1 oracle dba     1771 May 14 11:59 initmydb1.ora.orig
-rw-r--r-- 1 oracle dba     2851 May 15  2009 init.ora.orig
-rw-r----- 1 oracle dba       24 May 15 09:35 lkMOMORAC
[oracle@my2950 dbs]$ 
[oracle@my2950 dbs]$ 
[oracle@my2950 dbs]$ 
[oracle@my2950 dbs]$ cp initmydb1.ora initmydb1.ora.momorac
[oracle@my2950 dbs]$ rm -f initmomorac.ora 
[oracle@my2950 dbs]$ vi initmydb1.ora

[oracle@my2950 dbs]$ logout
[root@my2950 ~]# su - oracle
[oracle@my2950 ~]$ set |grep -i oracle
BASE_PATH=/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib/oracle/11.2/client64/bin:/home/oracle/bin
CLASSPATH=/u01/app/oracle/product/11.2.3/db_1/JRE:/u01/app/oracle/product/11.2.3/db_1/jlib:/u01/app/oracle/product/11.2.3/db_1/rdbms/jlib
DB_HOME=/u01/app/oracle/product/11.2.3/db_1
HISTFILE=/home/oracle/.bash_history
HOME=/home/oracle
LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.3/db_1/lib:/lib:/usr/lib
LOGNAME=oracle
MAIL=/var/spool/mail/oracle
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.3/db_1
ORACLE_HOSTNAME=my2950.momo.org
ORACLE_SID=mydb1
ORACLE_TERM=xterm
ORACLE_UNQNAME=mydb1
PATH=/u01/app/oracle/product/11.2.3/db_1/bin:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib/oracle/11.2/client64/bin:/home/oracle/bin
PWD=/home/oracle
USER=oracle
[oracle@my2950 ~]$


[oracle@my2950 dbs]$ orapwd -h
Usage: orapwd file= entries= force= ignorecase= nosysdba=

  where
    file - name of password file (required),
    password - password for SYS will be prompted if not specified at command line,
    entries - maximum number of distinct DBA (optional),
    force - whether to overwrite existing file (optional),
    ignorecase - passwords are case-insensitive (optional),
    nosysdba - whether to shut out the SYSDBA logon (optional Database Vault only).
    
  There must be no spaces around the equal-to (=) character.
[oracle@my2950 dbs]$ 

[oracle@my2950 dbs]$ orapwd file=orapwmydb1 entries=10

Enter password for SYS: 
[oracle@my2950 dbs]$ ls -l
total 18484
-rw-r----- 1 oracle dba 18890752 May 15 17:17 control02.ctl
-rw-rw---- 1 oracle dba     1544 May 15 17:17 hc_momorac.dat
-rw-rw---- 1 oracle dba     1544 May 14 14:52 hc_mydb1.dat
-rw-r--r-- 1 oracle dba       14 May 14 11:51 initmydb11.ora
-rw-r--r-- 1 oracle dba     2257 May 15 17:21 initmydb1.ora
-rw-r--r-- 1 oracle dba     2257 May 15 17:20 initmydb1.ora.momorac
-rw-r--r-- 1 oracle dba     1771 May 14 11:59 initmydb1.ora.orig
-rw-r--r-- 1 oracle dba     2851 May 15  2009 init.ora.orig
-rw-r----- 1 oracle dba       24 May 15 09:35 lkMOMORAC
-rw-r----- 1 oracle dba     2560 May 15 17:27 orapwmydb1
[oracle@my2950 dbs]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Thu May 15 17:27:58 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> conn / as sysdba
Connected to an idle instance.
SQL> 
SQL> startup
ORACLE instance started.

Total System Global Area  296456192 bytes
Fixed Size                  2227784 bytes
Variable Size             109052344 bytes
Database Buffers          180355072 bytes
Redo Buffers                4820992 bytes
Database mounted.
Database opened.
SQL> 

SQL> select dbid,name from v$database;

      DBID NAME
---------- ---------
1497461080 MYDB1

SQL> 
SQL> host ls -l ~/rman/
total 2063136
-rw-r--r-- 1 oracle dba          0 May 15 10:03 alter
-rw-r----- 1 oracle dba 2084896768 May 14 17:25 data_20140514_1497461080_MOMORAC_1jp89f42_1_1
-rw-r----- 1 oracle dba    8781824 May 14 17:25 data_20140514_1497461080_MOMORAC_1kp89fb5_1_1
-rw-r----- 1 oracle dba   18972672 May 14 17:25 data_20140514_1497461080_MOMORAC_1lp89fb9_1_1
-rw-r--r-- 1 oracle dba          0 May 15 10:03 select

[oracle@my2950 u01]$ find ./ -name momorac -type d -print
./app/oracle/diag/rdbms/mydb1/momorac
./app/oracle/diag/rdbms/momorac
./app/oracle/diag/rdbms/momorac/momorac
[oracle@my2950 u01]$ 


修改zabbix的配置文件



[oracle@my2950 ~]$ logout
[root@my2950 ~]# cd /etc/zabbix/
[root@my2950 zabbix]# ls -l
total 64
drwxr-xr-x 5 root   root    4096 Jun 21  2013 bak
-rw-r--r-- 1 root   root       0 Jun 21  2013 test
drwxr-x--- 2 apache apache  4096 Jun 19  2013 web
-rw-r--r-- 1 root   root    5831 Jun 18  2013 zabbix_agentd.conf
-rw-r--r-- 1 root   root    5814 Jun  9  2013 zabbix_agentd.conf.orig
drwxr-xr-x 2 root   root    4096 Jun  9  2013 zabbix_agentd.d
-rw-r----- 1 root   zabbix 10692 Jun 24  2013 zabbix_server.conf
-rw-r----- 1 root   root   10678 Jun 21  2013 zabbix_server.conf~
-rw-r----- 1 root   root   10655 Jun  9  2013 zabbix_server.conf.orig
[root@my2950 zabbix]# cp zabbix_server.conf zabbix_server.conf.momorac
[root@my2950 zabbix]# 

[root@my2950 zabbix]# more zabbix_server.conf|grep ^[^#$]
NodeID=0
ListenPort=10051
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=10
DebugLevel=3
PidFile=/var/run/zabbix/zabbix_server.pid
DBHost=127.0.0.1
DBName=mydb1
DBUser=zabbix
DBPassword=111111
DBSocket=/var/lib/mysql/mysql.sock
DBPort=1521
SNMPTrapperFile=/var/log/snmptt/snmptt.log
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
[root@my2950 zabbix]# 
[root@my2950 zabbix]# 

还得修改

/usr/share/zabbix/conf/ 下的 zabbix.conf.php

登陆web界面, ok
































阅读(1649) | 评论(0) | 转发(0) |
0

上一篇:卸载oracle 12C

下一篇:AIX 5.3安装zabbix agent

给主人留下些什么吧!~~