34.14. 切换字符集

简介:

34.14.1. 切换到 GBK

			
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter system enable restricted session;
SQL> alter system set job_queue_processes=0;
SQL> alter database open;
SQL> alter database character set internal_use ZHS16GBK;
SQL> shutdown immediate;
SQL> startup
SQL> alter system disable restricted session;
			
			

34.14.2. 切到 UTF-8

			
sqlplus "/ as sysdba"
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP MOUNT
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SQL> ALTER DATABASE OPEN
SQL> ALTER DATABASE NATIONAL CHARACTER SETINTERNAL_USE UTF8;
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP
			
			

34.14.3. 切到 AL32UTF8

			
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter system enable restricted session;
SQL> alter system set job_queue_processes=0;
SQL> alter database open;
SQL> alter database character set internal_use AL32UTF8;
SQL> shutdown immediate;
SQL> startup
SQL> alter system disable restricted session;
			
			

34.14.4. 切换过程实例

例 34.1. Oracle 字符集切换实例

				
C:\Users\Administrator>sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Mon Nov 30 17:01:10 2015

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

Enter user-name: sys as sysdba
Enter password:

Connected to:
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production

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

Total System Global Area 3423965184 bytes
Fixed Size                  2180544 bytes
Variable Size            1879050816 bytes
Database Buffers         1526726656 bytes
Redo Buffers               16007168 bytes
Database mounted.
SQL> alter system enable restricted session;

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 ZHS16GBK;

Database altered.

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

Total System Global Area 3423965184 bytes
Fixed Size                  2180544 bytes
Variable Size            1879050816 bytes
Database Buffers         1526726656 bytes
Redo Buffers               16007168 bytes
Database mounted.
Database opened.
SQL> alter system disable restricted session;

System altered.

SQL>


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

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

SQL>
			





原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

目录
相关文章
|
7月前
|
数据处理
自定义字符集
自定义字符集
118 2
|
7月前
|
Windows
win11默认输入法字符集切换
在使用 IntelliJ 系列应用开发时,老是会时不时的将Windows的输入法就变为了繁体,后面就仔细的搜索了下,发现就是由于Windows11的字符集切换快捷键是 ctrl+shift+F , 而在 IntelliJ 系列产品中 ctrl+shift+F 是其中一个比较常用的快捷键(例如:IDEA中就使用改快捷键用来作为全局搜索),就导致了在开发了一段时间后,Windows的输入法就变为了繁体。
189 0
|
SQL Oracle 关系型数据库
修改oracle数据库字符集
修改oracle数据库字符集
|
XML Oracle 关系型数据库
修改字符集|学习笔记
快速学习修改字符集
196 0
修改字符集|学习笔记
|
数据库
数据库写入中文乱码问题 编码latin1解决方法
数据库写入中文乱码问题 编码latin1解决方法
174 0
|
存储 关系型数据库 MySQL
|
SQL Oracle 关系型数据库
|
关系型数据库 MySQL 数据库