我的编程空间,编程开发者的网络收藏夹
学习永远不晚

RAC修改字符集

短信预约 信息系统项目管理师 报名、考试、查分时间动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

RAC修改字符集

字符集修改做过几次了,这次感觉还是有点不顺,走了弯路,再记一遍
【概况】
准备搭建RAC+RAC DG,发现两端字符集不大一致,担心到时出问题。

【目标】
将备库NLS_NCHAR_CHARACTERSET修改成与主库一致。
--备
NLS_NCHAR_CHARACTERSET UTF8
修改为
--主
NLS_NCHAR_CHARACTERSET AL16UTF16

0、备库 修改前
PRIMARY-SYS@TESTDB2>set pagesize 100
PRIMARY-SYS@TESTDB2>col value$ for a30
PRIMARY-SYS@TESTDB2>select name,value$ from props$ where name like "%NLS%";

NAME VALUE$
------------------------------------------------------------------------------------------ ------------------------------
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET ZHS16GBK
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET UTF8
NLS_RDBMS_VERSION 11.2.0.4.0

20 rows selected.

节点2 先停掉,在节点1修改完成后再启动
[root@NODE2 ~]# ls -l /u01/app/11.2.0/grid/bin/crsctl
-rwxr-xr-x 1 root oinstall 8576 Jan 13 2017 /u01/app/11.2.0/grid/bin/crsctl
[root@NODE2 ~]#
[root@NODE2 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster
CRS-2673: Attempting to stop "ora.crsd" on "NODE2"
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on "NODE2"
CRS-2673: Attempting to stop "ora.LISTENER_SCAN1.lsnr" on "NODE2"
CRS-2673: Attempting to stop "ora.LISTENER.lsnr" on "NODE2"
CRS-2673: Attempting to stop "ora.CRSDG.dg" on "NODE2"
CRS-2673: Attempting to stop "ora.TESTDB.db" on "NODE2"
CRS-2677: Stop of "ora.LISTENER_SCAN1.lsnr" on "NODE2" succeeded
CRS-2673: Attempting to stop "ora.scan1.vip" on "NODE2"
CRS-2677: Stop of "ora.LISTENER.lsnr" on "NODE2" succeeded
CRS-2673: Attempting to stop "ora.NODE2.vip" on "NODE2"
CRS-2677: Stop of "ora.scan1.vip" on "NODE2" succeeded
CRS-2672: Attempting to start "ora.scan1.vip" on "NODE1"
CRS-2677: Stop of "ora.NODE2.vip" on "NODE2" succeeded
CRS-2672: Attempting to start "ora.NODE2.vip" on "NODE1"
CRS-2677: Stop of "ora.TESTDB.db" on "NODE2" succeeded
CRS-2673: Attempting to stop "ora.DATA.dg" on "NODE2"
CRS-2673: Attempting to stop "ora.FRA.dg" on "NODE2"
CRS-2677: Stop of "ora.DATA.dg" on "NODE2" succeeded
CRS-2677: Stop of "ora.FRA.dg" on "NODE2" succeeded
CRS-2676: Start of "ora.scan1.vip" on "NODE1" succeeded
CRS-2672: Attempting to start "ora.LISTENER_SCAN1.lsnr" on "NODE1"
CRS-2676: Start of "ora.NODE2.vip" on "NODE1" succeeded
CRS-2676: Start of "ora.LISTENER_SCAN1.lsnr" on "NODE1" succeeded
CRS-2677: Stop of "ora.CRSDG.dg" on "NODE2" succeeded
CRS-2673: Attempting to stop "ora.asm" on "NODE2"
CRS-2677: Stop of "ora.asm" on "NODE2" succeeded
CRS-2673: Attempting to stop "ora.ons" on "NODE2"
CRS-2677: Stop of "ora.ons" on "NODE2" succeeded
CRS-2673: Attempting to stop "ora.net1.network" on "NODE2"
CRS-2677: Stop of "ora.net1.network" on "NODE2" succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on "NODE2" has completed
CRS-2677: Stop of "ora.crsd" on "NODE2" succeeded
CRS-2673: Attempting to stop "ora.ctssd" on "NODE2"
CRS-2673: Attempting to stop "ora.evmd" on "NODE2"
CRS-2673: Attempting to stop "ora.asm" on "NODE2"
CRS-2677: Stop of "ora.evmd" on "NODE2" succeeded
CRS-2677: Stop of "ora.asm" on "NODE2" succeeded
CRS-2673: Attempting to stop "ora.cluster_interconnect.haip" on "NODE2"
CRS-2677: Stop of "ora.cluster_interconnect.haip" on "NODE2" succeeded
CRS-2677: Stop of "ora.ctssd" on "NODE2" succeeded
CRS-2673: Attempting to stop "ora.cssd" on "NODE2"
CRS-2677: Stop of "ora.cssd" on "NODE2" succeeded
[root@NODE2 ~]#

节点1

PRIMARY-SYS@TESTDB1>show parameter pfile;

NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
spfile string +DATA/TESTDB/parameterfile/spf
ile.344.1016736315
PRIMARY-SYS@TESTDB1>create pfile from spfile;
--这样的话就直接修改上面生成的pfile文件中cluster_database=false 用pfile mount +修改INTERNAL_USE + open ,然后再创建spfile共节点2一起使用

--下面没必要修改spfile,保持spfile(两节点共享的)中cluster_database=TRUE
--alter system set cluster_database=false;
PRIMARY-SYS@TESTDB1>alter system set cluster_database=false scope=spfile;

System altered.

--需要【重启】才能生效,尽管上面已经修改了
PRIMARY-SYS@TESTDB1>show parameter cluster_database

NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
PRIMARY-SYS@TESTDB1>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

--mv initTESTDB1.ora initTESTDB1.ora.bak,最后又mv回来了,没改回就报下面的错了
PRIMARY-SYS@TESTDB1>startup mount;
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file "/u01/app/oracle/product/11.2.0/db_home1/dbs/initTESTDB1.ora"

PRIMARY-SYS@TESTDB1>startup mount;
ORACLE instance started.

Total System Global Area 7.4826E+10 bytes
Fixed Size 2261048 bytes
Variable Size 4.6976E+10 bytes
Database Buffers 2.7649E+10 bytes
Redo Buffers 199049216 bytes
Database mounted.
PRIMARY-SYS@TESTDB1>ALTER SYSTEM ENABLE RESTRICTED SESSION;

System altered.

PRIMARY-SYS@TESTDB1>ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;

System altered.

PRIMARY-SYS@TESTDB1>ALTER SYSTEM SET AQ_TM_PROCESSES=0;

System altered.

PRIMARY-SYS@TESTDB1>ALTER DATABASE OPEN;

Database altered.
--这一步是【重点要修改的】
PRIMARY-SYS@TESTDB1>ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE AL16UTF16;

Database altered.

--pfile启动了,没法修改spfile了
PRIMARY-SYS@TESTDB1>alter system set cluster_database=true scope=spfile sid="*";
alter system set cluster_database=true scope=spfile sid="*"
*
ERROR at line 1:
ORA-32001: write to SPFILE requested but no SPFILE is in use


PRIMARY-SYS@TESTDB1>show parameter pfile;

NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
spfile string

--手动修改initTESTDB1.ora中的cluster_database=true,重建spfile
PRIMARY-SYS@TESTDB1>create spfile from pfile="/u01/app/oracle/product/11.2.0/db_home1/dbs/initTESTDB1.ora";

File created.

PRIMARY-SYS@TESTDB1>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
PRIMARY-SYS@TESTDB1>startup mount;
ORACLE instance started.

Total System Global Area 7.4826E+10 bytes
Fixed Size 2261048 bytes
Variable Size 4.6976E+10 bytes
Database Buffers 2.7649E+10 bytes
Redo Buffers 199049216 bytes
Database mounted.
--还得改回去,0->1
PRIMARY-SYS@TESTDB1>ALTER SYSTEM DISABLE RESTRICTED SESSION;

System altered.

PRIMARY-SYS@TESTDB1>ALTER SYSTEM SET JOB_QUEUE_PROCESSES=1;

System altered.

PRIMARY-SYS@TESTDB1>ALTER SYSTEM SET AQ_TM_PROCESSES=1;

System altered.

PRIMARY-SYS@TESTDB1>show parameter pfile;

NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0
/db_home1/dbs/spfileTESTDB1.or
a
PRIMARY-SYS@TESTDB1>alter system set cluster_database=true scope=spfile sid="*";

System altered.

PRIMARY-SYS@TESTDB1>alter database open;

Database altered.


--cluster_database【重启】才生效

PRIMARY-SYS@TESTDB1>show parameter cluster_database

NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
cluster_database boolean FALSE
cluster_database_instances integer 1
PRIMARY-SYS@TESTDB1>shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
PRIMARY-SYS@TESTDB1>
PRIMARY-SYS@TESTDB1>
PRIMARY-SYS@TESTDB1>
PRIMARY-SYS@TESTDB1>startup
ORACLE instance started.

Total System Global Area 7.4826E+10 bytes
Fixed Size 2261048 bytes
Variable Size 4.9392E+10 bytes
Database Buffers 2.5233E+10 bytes
Redo Buffers 199049216 bytes
Database mounted.
Database opened.
PRIMARY-SYS@TESTDB1>show parameter cluster_database

NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
PRIMARY-SYS@TESTDB1>

PRIMARY-SYS@TESTDB1>set pagesize 100
PRIMARY-SYS@TESTDB1>col value$ for a30
PRIMARY-SYS@TESTDB1>select name,value$ from props$ where name like "%NLS%";

NAME VALUE$
------------------------------------------------------------------------------------------ ------------------------------
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET ZHS16GBK
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
--发现已【修改】成功
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_RDBMS_VERSION 11.2.0.4.0

20 rows selected.

PRIMARY-SYS@TESTDB1>


3、第二个节点启动
[root@NODE2 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster
CRS-2672: Attempting to start "ora.cssdmonitor" on "NODE2"
CRS-2676: Start of "ora.cssdmonitor" on "NODE2" succeeded
CRS-2672: Attempting to start "ora.cssd" on "NODE2"
CRS-2672: Attempting to start "ora.diskmon" on "NODE2"
CRS-2676: Start of "ora.diskmon" on "NODE2" succeeded
CRS-2676: Start of "ora.cssd" on "NODE2" succeeded
CRS-2672: Attempting to start "ora.ctssd" on "NODE2"
CRS-2676: Start of "ora.ctssd" on "NODE2" succeeded
CRS-2672: Attempting to start "ora.evmd" on "NODE2"
CRS-2672: Attempting to start "ora.cluster_interconnect.haip" on "NODE2"
CRS-2676: Start of "ora.evmd" on "NODE2" succeeded
CRS-2676: Start of "ora.cluster_interconnect.haip" on "NODE2" succeeded
CRS-2672: Attempting to start "ora.asm" on "NODE2"
CRS-2676: Start of "ora.asm" on "NODE2" succeeded
CRS-2672: Attempting to start "ora.crsd" on "NODE2"
CRS-2676: Start of "ora.crsd" on "NODE2" succeeded

--设置了自动重启,所以失败。。。
PRIMARY-SYS@TESTDB2>startup mount
ORA-10997: another startup/shutdown operation of this instance inprogress
ORA-09968: unable to lock file
Linux-x86_64 Error: 11: Resource temporarily unavailable
Additional information: 169786
。。。自启动了。。。

--稍等发现已启动OK
PRIMARY-SYS@TESTDB2>select inst_id,instance_name,status from gv$instance;

INST_ID INSTANCE_NAME STATUS
---------- ------------------------------------------------ ------------------------------------
2 TESTDB2 OPEN
1 TESTDB1 OPEN

2 rows selected.

自此两个节点都OK了


【总结】
上面可能说的有点乱,捋一捋。。。不知道说的对不对
0、做事之前要盘算计划好,眼高手低是技术一大障碍,说来都很美好,做起来总不是那么一帆风顺的,稍微一个错误浪费的时间比事前多花点时间准备好多了,当然牛人除外,能够及时处理。
1、根据节点1生成的pfile,修改cluster_database=false启动修改,然后再改回来是不是少点麻烦
2、修改字符集要关闭一个节点,在另外一个节点修改,修改前要把这个节点的cluster_database改成false(别改spfile,spfile是两个节点公用的,改了等下又要改回来,重复工作!),重启(才生效),修改时按照上面mount之后操作即可,修改后再把0改成1,cluster_database再改成true,重启(生效),启动节点2(还是修改之前的spfile额,cluster_database仍为true),结束。


【小插曲】两节点不从ASM中的spfile启动了
PRIMARY-SYS@DINPAY1>show parameter pfile;

NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0
/db_home1/dbs/spfileDINPAY1.or
a
PRIMARY-SYS@DINPAY1>create pfile from spfile;

File created.

PRIMARY-SYS@DINPAY1>create spfile from pfile="/u01/app/oracle/product/11.2.0/db_home1/dbs/initDINPAY1.ora";
create spfile from pfile="/u01/app/oracle/product/11.2.0/db_home1/dbs/initDINPAY1.ora"
*
ERROR at line 1:
ORA-32002: cannot create SPFILE already being used by the instance

PRIMARY-SYS@DINPAY1>shut immediate

PRIMARY-SYS@DINPAY1>startup pfile="/u01/app/oracle/product/11.2.0/db_home1/dbs/initDINPAY1.ora";

PRIMARY-SYS@DINPAY1>show parameter pfile;

NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
spfile string
PRIMARY-SYS@DINPAY1>create spfile="+data" from pfile="/u01/app/oracle/product/11.2.0/db_home1/dbs/initDINPAY1.ora";

File created.
PRIMARY-SYS@DINPAY1>show parameter pfile;

NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
spfile string
PRIMARY-SYS@DINPAY1>shut immediate

--grid登陆查找生成spfile位置
ASMCMD> cd +DATA/dinpay/parameterfile/
ASMCMD> ls
spfile.282.1016709123
spfile.343.1016734531
spfile.344.1016736315
spfile.346.1025548589
--刚刚生成的
+DATA/dinpay/parameterfile/spfile.346.1025548589

--更新pfile,别这样create pfile from spfile;指定pfile生成位置
[oracle@zhjlrac1 dbs]$ pwd
/u01/app/oracle/product/11.2.0/db_home1/dbs
[oracle@szml02-db01 dbs]$ cat initDINPAY1.ora
SPFILE="+DATA/dinpay/parameterfile/spfile.346.1025548589"

PRIMARY-SYS@DINPAY1>startup
ORACLE instance started.

Total System Global Area 7.4826E+10 bytes
Fixed Size 2261048 bytes
Variable Size 4.9124E+10 bytes
Database Buffers 2.5501E+10 bytes
Redo Buffers 199049216 bytes
Database mounted.
Database opened.
PRIMARY-SYS@DINPAY1>

PRIMARY-SYS@DINPAY1>show parameter pfile;

NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
spfile string +DATA/dinpay/parameterfile/spf
ile.346.1025548589
另外一个节点页如上指向这个spfile,重启OK。

如果直接使用create pfile from spfile;命令创建pfile,那么生成的pfile 文件将覆盖原有$ORACLE_HOME/dbs 目录下的pfile 文件。 而在之前的pfile文件里面值保留了一条指向spfile存放位置的记录。 这样修改之后,就会造成数据库启动时会因为找不到spfile文件而读取本地的pfile文件,而不是共享设备上的spfile文件。这样对参数管理上就会带来麻烦,也带来其他的隐患。
所以对于RAC,要慎用 create pfile from spfile; 来创建pfile 文件, 在创建的时候,尽量指定pfile的生成位置

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

RAC修改字符集

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

RAC修改字符集

字符集修改做过几次了,这次感觉还是有点不顺,走了弯路,再记一遍【概况】准备搭建RAC+RAC DG,发现两端字符集不大一致,担心到时出问题。【目标】将备库NLS_NCHAR_CHARACTERSET修改成与主库一致。--备NLS_NCHAR_CHARACTER
2017-09-21

sqlserver如何修改字符集

在SQL Server中,可以使用以下步骤来修改字符集:首先,连接到SQL Server Management Studio。打开要修改字符集的数据库。在数据库上右键单击,选择“属性”。在“属性”窗口中,选择“选项”选项卡。在“选项”选项卡
sqlserver如何修改字符集
2024-04-09

linux如何修改字符集

linux如何修改字符集,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。修改字符集的方法:1、直接设置“export LANG=需要的字符集”;2、打开“/etc/sysconf
2023-06-22

如何修改MySQL字符集

一、查看MySQL的字符集show variables like '%char%'; 二、修改MySQL配置文件 不是安装目录,是数据目录。 我是用sublime打开的。进去之后,在三个地方增加配置。 第一个:[client]default
2022-05-26

linux怎样修改字符集

小编给大家分享一下linux怎样修改字符集,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!方法:1、利用“LANG=字符集”或者“export LANG=字符集”
2023-06-29

linux字符集如何修改

这篇“linux字符集如何修改”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“linux字符集如何修改”文章吧。修改方法:1、
2023-06-29

oracle字符集如何修改

要修改Oracle字符集,可以按照以下步骤进行操作:1. 进入Oracle数据库服务器的命令行界面。2. 使用SYSDBA或者SYSOPER权限的用户登录到数据库。3. 检查当前的数据库字符集设置。可以使用以下命令查询:```sqlSELE
2023-09-23

oracle字符集怎么修改

要修改 oracle 字符集,可以按以下步骤进行:修改数据库字符集:alter database character set 修改表或列字符集:alter table modify 如何修改 Oracle 字符集Oracle 数据库使
oracle字符集怎么修改
2024-05-30

如何修改oracle字符集

要修改 oracle 字符集,需要:备份数据库;在 init.ora 文件中修改字符集设置;重新启动数据库;修改现有表和列以使用新字符集;重新加载数据;修改数据库链接(可选)。修改 Oracle 字符集如何修改 Oracle 字符集?要
如何修改oracle字符集
2024-06-13

oracle 字符集修改 AL32UTF8 改为 ZHS16GBK

在使用ORACLE的过程中,会出现各种各样的问题,各种各样的错误,其中ORA-12899就是前段时间我在将数据导入到我本地机器上的时候一直出现的问题.不过还好已经解决了这个问题,现在分享一下,解决方案;出现ORA-12899,是字符集引起的,中文在UTF-8中
oracle 字符集修改 AL32UTF8 改为 ZHS16GBK
2014-09-09

java怎么修改Eclipse字符集

这篇文章将为大家详细讲解有关java怎么修改Eclipse字符集,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。1、默认情况下,Eclipse字符集是GBK,但是现在很多项目都是UTF-8,所以我们需要设置
2023-06-15

编程热搜

目录