Solved

how to determine the oracle version and default character encoding?

Posted on 2003-10-22
5
26,820 Views
Last Modified: 2011-08-18
Is there an easy way for somebody connected to an Oracle instance running on a host somewhere to determine 1) the version of Oracle that it's running under and 2) the default character encoding (UTF8, ISO-8859-1, ASCII7, etc)? I assume the values are stored and selectable in Oracle's housekeeping pseudo-tables, but don't have any idea which one(s).

Specifically... suppose I'm connected to the Oracle instance 'foo.database' running on the host 'foohost.mydomian.net' as the user 'bar' using SQL*Plus.

Suppose further that I need to create a table that contains an XMLType field, and I've learned the hard way that using XMLType fields in databases whose encoding ISN'T UTF-8 is just begging for grief and trouble, and that 9.2 fixes lots of bugs with XMLType that Oracle never fixed in 9.0.

Finally, assume it's 3am on Monday morning with a demo looming at noon, the DBA is sound asleep, and I have access to nearly a dozen running instances of Oracle on nearly a half-dozen hosts, running everything from 8i to 9.2i... most using Windows native character encoding (WEI-*?), a couple using ISO-8859-1, and a few using UTF-8. Before I waste an hour setting up the new tables, stored procedures, sequences, and triggers, I want to make sure I'm actually connected to a UTF8-encoded instance running 9.2. How?
0
Comment
Question by:jskubick
  • 3
5 Comments
 
LVL 48

Expert Comment

by:schwertner
ID: 9599048
1. Version (as user SYS)
select * from v$version;

2 Character set

SQL> connect system/manager@lin1
Connected.
SQL> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
VALUE
UTF8
SQL> select value from nls_database_parameters where parameter='NLS_NCHAR_CHARACTERSET';
VALUE
UTF8
SQL>
0
 
LVL 23

Assisted Solution

by:seazodiac
seazodiac earned 25 total points
ID: 9599050
to know the version of oracle:

in the sqlplus window:

SQL> select * from v$version;

to know that characterset encoding of oracle database:

SQL> show parameter NLS

0
 
LVL 48

Accepted Solution

by:
schwertner earned 100 total points
ID: 9599119
Looking at this and at the above entry it is easy to understatand where youa are connenected,

SQL> connect sys/manager@test as sysdba
Connected.
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
PL/SQL Release 9.2.0.4.0 - Production
CORE    9.2.0.3.0       Production
TNS for 32-bit Windows: Version 9.2.0.4.0 - Production
NLSRTL Version 9.2.0.4.0 - Production

SQL>

if you add the following statement it will be easy to know also the name of instance and possibly some parameters of the instance;
SQL> show parameter db_name;

NAME                                 TYPE        VALUE
------------------------------------ ----------- -------------------
db_name                              string      test
0
 

Author Comment

by:jskubick
ID: 9599121
OK, "select * from v$version;" worked :-)

Unfortunately, "show parameter NLS" didn't quite do the trick... it just indicated that various parameters are of type "string"... a few of which had values of "AMERICA", "BYTE", or "FALSE" (most had no value).

What I need to know is the database's default encoding... ie, UTF8, WEISOWIN12 (I'm sure I mangled that one... it's the default windows character encoding), ASCII7, etc.
0
 
LVL 48

Expert Comment

by:schwertner
ID: 9599269
You are to fast and do not read what I mentioned:

SQL> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
VALUE
UTF8
SQL> select value from nls_database_parameters where parameter='NLS_NCHAR_CHARACTERSET';
VALUE
UTF8
SQL>


This definitelly showa the character set of the DATABASE.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question