Wednesday, September 18, 2013

Installing Oracle Database Part 01

Dear Readers,

My name is Franz Devantier, creator of this blog.  I am an Oracle Certified Professional (OCP DBA 11g) Security DBA.  I will be sharing with you the basic duties of an Oracle DBA, and also some of the undocumented, and not so well known tasks. 

Installing Oracle Database Part 01
You can obtain the Oracle Database software on installation media.  It is probably easier to download it from the Oracle Technology Network Website.  You can also download from the Oracle Software Delivery Cloud portal.  Once you have the media, then you can install the software.  Typically you would use the Graphical User Interface (GUI) that is part of Oracle Universal Installer (OUI), to install the software.  You may have to configure your X-Windows before using the GUI.  You can also use OUI to install using silent mode installation.

Reviewing Component-Specific Installation Guidelines
We will assume that the pre-installation tasks have been completed.  Now we can review some guidelines before starting OUI.
=> Using OUI from an earlier release of Oracle to install components from a current release is no longer allowed.

=> Oracle Automatic Storage Management (Oracle ASM);
In previous releases Oracle ASM was installed as part of the database installation.  However from 11.2 onwards Oracle ASM is installed as part of the Oracle Grid Infrastructure Installation, either for a cluster, or for a standalone server.

If you want to upgrade an existing Oracle ASM installation, then you upgrade the Oracle ASM by running the Oracle Grid Infrastructure upgrade.

If you do not have Oracle ASM installed, and you want to use Oracle ASM as your storage option, then you should complete an Oracle Grid Infrastructure installation, before you start your Oracle database installation.

=> Installing on a cluster;
If Oracle CLusterware and Oracle RAC are installed on the system, then OUI will display the “Specify Hardware Cluster Installation” screen.  You must select the Local Installation option, unless of course you want to install a RAC configuration.

=> Selecting the Database Character Set
The database character set is used for various purposes.
- Data that is stored in SQL character datatypes, such as CHAR, VARCHAR2, CLOB, LONG.
- Identifiers such as table names, column names and PL/SQL variables.
- Stored PL/SQL and SQL source code, which includes text literals that are embedded in the code.

Changing the character set after a database is created, can take a lot of time and resources.  Also you should consider that if you are converting from a bigger character set to a smaller character set, that you will be losing the definition of characters that are described in the bigger set, but not the smaller set.  Going from a smaller set to a bigger set is generally more successful.

In order to convert the character data, you may need to export the entire database in one character set, and import it in another character set.  You must decide which character set the application is going to use against the database, before you make this decision.

Oracle recommends that you use Unicode AL32UTF8 as your default database character set.  Unicode is a universal character set that will support most of the currently spoken languages of the world, as well as a number of historical alphabets or scripts.

Unicode is also the native encoding of technologies such as Java, XML, XHTML, ECMAScript, and LDAP.  Unicode then displays its usefulness when a database is supporting the internet and global economy, because it can handle all these codes.

AL32UTF8 is a multibyte character set, and so will in most cases be slower in the database than single byte character sets such as WE8MSWIN1252.  Also ASCII characters stored in a multibyte character sets such as AL32UTF8, increases the storage space required.  However the increase in storage space relates only to character based data, and data that is not in English.  However because Unicode for AL32UTF8 is universal and very flexible, it balances well against the additional costs of using Unicode.

However don’t just select AL32UTF8 as your character code.  You should first determine which legacy character codes are being used, and their compatibility to Unicode.  You should consider the storage requirements.  If the performance around text processing is critical, then you should not use a character set that would potentially slow the processing down.  If you determine that the database supports a very limited set of languages, if the character set of most clients connecting to the database is also a legacy character set.  Then that legacy character set may be the best choice.

Also when you run OUI, the suggested or default character set will be based on the language configuration of the Operating System.  So don’t just accept the default, it may not be the ideal character set for your installation.  For many languages including English, the default character set recommended is usually one of the Microsoft Windows character sets, such as WE8MSWIN1252.  This is even recommended on a Linux box.  The reason for this recommendation on Linux is that Oracle makes the assumption that most of the clients connecting to the database, will be Microsoft clients.  The database must be able to store all the characters coming from the clients, otherwise your character data could become corrupted.  Because Microsoft Windows has a richer character repertoire than the ISO 8859 character sets, the Microsoft Windows character sets are usually chosen.

To give an insight into this: EE8MSWIN1250 supports the Euro currency symbol, as well as various small quote characters.  The corresponding character set EE8ISO8859P2 does not support these symbols.

The Oracle Database will convert the data between the database character set and the client character sets.  The client character sets are declared in the NLS_LANG settings.  It would make sense to always have a character set on the database that has a larger set of characters, then the client character sets.  That way you will protect your character data integrity.

OUI presents only the recommended character sets to you during an installation, although the Oracle database supports many more character sets than are displayed to choose from.  Most of the character sets not displayed are either deprecated, or are a binary subset of another character set.  For example WE8DEC is a deprecated character set.  US7ASCII and WE8ISO8859P1 are both binary subsets of WE8MSWIN1252.  

If you have carefully decided on a certain character set for your database, in order to be compatible with other legacy systems for example.  You may find that the character set is not one of the recommended character sets.  You can then select the “Advanced Database Configuration” option.  The Database Configuration Assistant (DBCA) in the interactive mode, will then allow you to select any of the database character sets that are supported on Linux.

Using an Oracle Automatic Storage Management Disk Group
You only need to do this, if you are going to use an ORACLE ASM disk group.  You can store database files as well as recovery files in an existing Oracle ASM disk group, that was created during the Oracle Grid Infrastructure installation.  Remember that the Oracle ASM instance will manage the existing disk groups that are running in the Oracle Grid Infrastructure home direcotory.

Firstly you will need to determine if an existing Oracle ASM disk group exists, and if there is sufficient disk space in the disk group for your purposes.
=> First go and view the contents of the oratab file, because if an Oracle ASM instance is configured on the system, you will see the evidence here.
# more /etc/oratab
You will be looking for a line similar to this:
+ASM:oracle_home_path:N
“+ASM” is the system identifier (SID) of the Oracle ASM instance.
“oracle_home_path” is the Oracle home directory where the Oracle ASM is installed.  By convention the SID for an Oracle ASM instance should be “+ASM”.

=> Open a command shell, and set the ORACLE_SID and ORCLE_HOME environment variables for the Oracle ASM instance.
# export ORACLE_SID=+ASM
# export ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid/
If you are using a C shell, then you should know how the corresponding commands will look.

=> Use SQL*Plus to connect to the Oracle ASM instance as the SYS user with the SYSASM privilege.  If necessary you can start the ASM instance.
# $ORACLE_HOME/bin/sqlplus /nolog
SQL> connect sys as SYSASM
Enter Password: …
SQL> startup

=> You now want to view the existing disk groups, their redundancy level, and the amount of free disk space in each one.
SQL> select name, type, total_mb, free_mb from v$asm_diskgroup;
The relationship between total_mb and free_mb, will tell you what you need to know about the redundancy level.

=> Study the output, and see if you can identify a disk group with the appropriate redundancy level, and with sufficient free space for your purposes.  Allow for growth when you make this decision.   

=> If there is not sufficient disk space available you may decide to install or identify additional disk devices, that would be required to meet your storage requirements.  If you add a device to an existing disk group, Oracle recommends that the additional devices must have the same size, but also the same performance characteristics as the existing devices in the disk group.

Franz Devantier.

No comments:

Post a Comment