程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle教程 >> rac環境下修改oracle數據庫字符集為GBK

rac環境下修改oracle數據庫字符集為GBK

編輯:Oracle教程

今天安裝數據庫(oracle10.2.0.4)的時候字符集不小心沒有改動,導致界面亂碼,由於是rac環境和單實例的不太一樣

http://blog.csdn.net/rulev5/article/details/7020134

1、查詢當前的字符集

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
--------------------------------------------------------------------------------
AMERICAN_AMERICA.WE8ISO8859P1

sql> alter system set cluster_database=false scope=spfile sid='jscn1';

紅色部分對於單實例的是不要加的,對於rac來說必須加上,不然會報

ORA-12720: operation requires database is in EXCLUSIVE mode

2、停止數據庫(rac1和rac2都要停止)

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

3、啟動數據庫(只在rac1上面操作)

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1577058304 bytes
Fixed Size 2084264 bytes
Variable Size 436208216 bytes
Database Buffers 1124073472 bytes
Redo Buffers 14692352 bytes
SQL> Alter database mount exclusive;

Database altered.

SQL> Alter system enable restricted session;

System altered.

SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;

System altered.
SQL> Alter database open;

Database altered.

4、修改字符集
SQL> ALTER DATABASE character set INTERNAL_USE zhs16gbk;
sql> alter system set cluster_database=true scope=spfile sid='jscn1';

5、驗證(兩個節點都要測)

Database altered.
SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area 1577058304 bytes
Fixed Size 2084264 bytes
Variable Size 436208216 bytes
Database Buffers 1124073472 bytes
Redo Buffers 14692352 bytes
Database mounted.
Database opened.
SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
--------------------------------------------------------------------------------
AMERICAN_AMERICA.ZHS16GBK

6、啟動rac2,驗證rac2的字符集(廢話,公用一個數據庫,當然一樣了)

 

//********************************************************//

 

以下為本人原創

今天按照上面blog,成功修改rac環境字符集 oracle 11.2.0.3 select userenv('language') from dual; SIMPLIFIED CHINESE_CHINA.ZHS16GBK 改為: select userenv('language') from dual; SIMPLIFIED CHINESE_CHINA.AL32UTF8 這是rac node1的操作

[oracle@ESCMDB01 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 6 16:13:51 2014

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

Connected to an idle instance.

SQL> startup ORACLE instance started.

Total System Global Area 1.6034E+10 bytes Fixed Size 2244192 bytes Variable Size 1.0133E+10 bytes Database Buffers 5838471168 bytes Redo Buffers 60059648 bytes Database mounted. Database opened. SQL> alter system set cluster_database=false scope=spfile sid='dzsw1';

System altered.

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

Total System Global Area 1.6034E+10 bytes Fixed Size 2244192 bytes Variable Size 1.0133E+10 bytes Database Buffers 5838471168 bytes Redo Buffers 60059648 bytes SQL> Alter database mount exclusive;

Database altered.

SQL> Alter system enable restricted session;

System altered.

SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;

System altered.

SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;

System altered.

SQL> Alter database open;

Database altered.

SQL> ALTER DATABASE character set INTERNAL_USE AL32UTF8;

Database altered.

SQL> alter system set cluster_database=true scope=spfile sid='dzsw1';

System altered.

SQL> SHUTDOWN IMMEDIATE; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup; ORACLE instance started.

Total System Global Area 1.6034E+10 bytes Fixed Size 2244192 bytes Variable Size 1.0133E+10 bytes Database Buffers 5838471168 bytes Redo Buffers 60059648 bytes Database mounted. Database opened. SQL> startup ORA-01081: cannot start already-running ORACLE - shut it down first SQL> select userenv('language') from dual;

USERENV('LANGUAGE') ---------------------------------------------------- AMERICAN_AMERICA.AL32UTF8

SQL>


rac node 2的操作,其中關機是一開始操作的,啟動是最後操作的。

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

Total System Global Area 1.6034E+10 bytes
Fixed Size                  2244192 bytes
Variable Size            1.0167E+10 bytes
Database Buffers         5804916736 bytes
Redo Buffers               60059648 bytes
Database mounted.
Database opened.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1.6034E+10 bytes
Fixed Size                  2244192 bytes
Variable Size            1.0167E+10 bytes
Database Buffers         5804916736 bytes
Redo Buffers               60059648 bytes
Database mounted.
Database opened.
SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.AL32UTF8

SQL> 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved