Set Oracle,sqlplus,linux set to UTF8 in Chinese, view the creation process of the table

Source: Internet
Author: User
Tags sqlplus

" This article declined to reprint Original from http://990487026.blog.51cto.com"



Thought:

1, set the Linux character set to UTF8 encoding

2, set the Oracle character set to UTF8 encoding

3, set the Sqlplus client environment to UTF8 encoding

4. If you are using the Crt/xshell remote tool in Windows, set the software code to utf8[slightly ...]




1, first set Oracle to UTF8

[[email protected] ~]$ sqlplus /nologsql>  conn /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 character set internal_use utf8; sql> shutdown immediate; sql> startup; sql> conn scott/11sql> set linesize 299; sql> set pagesize 299; Sql> select * from v$nls_parameters where parameter= ' NLS_CHARACTERSET '; Parameter value---------------- -----nls_characterset utf8sql> select userenv (' Language ')  from dual; american_america. Utf8sql> exit 



2,linux systems are generally UTF8 by default, with CentOS as an example:

[Email protected] ~]$ cat/etc/sysconfig/i18n lang= "en_US. UTF-8 "sysfont=" Latarcyrheb-sun16 "


3, set Sqlpuls environment variables, test

The value of Nls_lang is derived from the following statement:

Sql> Select Userenv (' language ') from dual;

American_america. UTF8


[[email protected] ~]$ cd /home/oracle/[[email protected] ~]$ echo  " Export nls_lang=\ "American_america. Utf8\ ""  >> .bashrc[[email protected] ~]$ . .bashrc[[email protected]  ~]$ echo  $NLS _langamerican_america. utf8[[email protected] ~]$ sqlplus scott/11sql> set linesize 299; sql> set pagesize 299; sql> create table student  (Sid number (2)  primary key, sname  VARCHAR2 ( NOT NULL,ADDRESS VARCHAR2),  SEX VARCHAR2 (1), Age number (2)); Sql> insert into student values (1, ' Song Jiang ', ' Liangshan heroes ', ' m ', 20); Sql> select * from student;       sid sname      address  s  age---------- ----- --- --------- --  - - ----------         1  Song Jiang        Liangshan heroes       m         20 to Scott's original table and test: sql> . Insert into dept (Deptno,dname,loc)  values (23, ' Zhong ', ' Guo ');   in sql> select * from dept;        23               Country 10 accounting  new  YORK20 RESEARCH  DALLAS30 SALES  CHICAGO40 OPERATIONS   Boston6 rows selected.



To view the creation process for a table:

Use Dbms_metadata. GET_DDL (' TABLE ', ' table_name ') function

sql> set pagesize 0; sql> set long 1000; Sql> select dbms_metadata. GET_DDL (' TABLE ', ' STUDENT ')  from dual;  CREATE TABLE  "SCOTT". " STUDENT "    (" SID " number (2,0)," SNAME " varchar2 ()  not null enable," ADDRESS " varchar2", "SEX"  varchar2 (1), "Age"  number (2,0), primary key  ("SID")   USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255   STORAGE (initial 65536 next 1048576 minextents 1 maxextents 2147483645   pctincrease 0 freelists 1 freelist groups 1 buffer_pool default  flash_cache default cell_flash_cache default)   TABLESPACE  "USERS"    ENABLE   )  SEGMENT CREATION IMMEDIATE  PCTFREE 10  pctused 40 initrans 1 Maxtrans 255 nocompress logging  storage (initial 65536 next 1048576  minextents 1 maxextents 2147483645  pctincrease 0 freelists 1  freelist groups 1 buffer_pool default flash_cache default cell_flash_ Cache default)   TABLESPACE  "USERS" sql>



This article from "Soul Bucket Luo" blog, declined reprint!

Set Oracle,sqlplus,linux set to UTF8 in Chinese, view the creation process of the table

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.