Cross Column

Showing posts with label Oracle Database 11g. Show all posts
Showing posts with label Oracle Database 11g. Show all posts

Thursday, November 7, 2013

ORA-01691: unable to extend lob segment

This article is one of the Oracle Application Test Suite (OATS)[1] series published on Xml and More, which includes the following:
Today, I have seen the following message:
ORA-1691: unable to extend lobsegment OLT.SYS_LOB0000079598C00002$ by 128 in tablespace USERS
from alert/log.xml, which was reported by the Oracle DB of OATS.[1]

In this article, we will show:
  1. How to investigate
  2. How to provide the solution

ORA-01691


If you see "ORA-01691" error, normally this means that the tablespace is full or that there is not an extent (aka chunk) available that fits the size needed.[2]

To investigate further, you can query the DB with the following SQL commands:[2]

SQL> set long 100000
SQL> select dbms_metadata.get_ddl('TABLESPACE','USERS') from dual;

DBMS_METADATA.GET_DDL('TABLESPACE','USERS')
--------------------------------------------------------------------------------

  CREATE TABLESPACE "USERS" DATAFILE
  '/scratch/aime1/app/oracle11.2.0.3.0/oradata/ps6stg7/users01.dbf' SIZE 5242880

  AUTOEXTEND ON NEXT 1310720 MAXSIZE 32767M
  LOGGING ONLINE PERMANENT BLOCKSIZE 8192
  EXTENT MANAGEMENT LOCAL AUTOALLOCATE DEFAULT
NOCOMPRESS  SEGMENT SPACE MANAGEMENT AUTO
   ALTER DATABASE DATAFILE
  '/scratch/aime1/app/oracle11.2.0.3.0/oradata/ps6stg7/users01.dbf' RESIZE 34359
214080

When I checked the used% of tablespace USERS, it showed that it's almost 100% full. So, the error is due to the tablespace being full.

SQL>  select * from dba_tablespace_usage_metrics order by used_percent desc;

TABLESPACE_NAME                USED_SPACE TABLESPACE_SIZE USED_PERCENT
------------------------------ ---------- --------------- ------------
USERS                             4194128         4194302   99.9958515

The Solution


You can find out what schema (or user) uses tablespace USERS by issuing the following SQL command:

SQL> select owner, table_name,tablespace_name from dba_tables where tablespace_name='USERS';

From the output, we know tablespace USERS is shared by the following users:
In our environment, we have used OLT to run load tests. For OLT, typically it is the session data that is taking most of the space in the DB. As an immediate workaround, you can try removing sessions from OLT Controller UI. However, it may run very slowly because tablespace USERS has already run out of space. To facilitate the session-removing task from OLT Controller UI, I have added 100MB to the tablespace USERS by giving it a second datafile:

SQL> ALTER TABLESPACE users ADD DATAFILE '/scratch/aime1/app/oracle11.2.0.3.0/oradata/ps6stg7/users02.dbf' size 100m;

Tablespace altered.

By adding some space to the tablespace, it helped smooth out the task of session removing. Admittedly, it was still a slow process. But, the solution worked.

References

  1. Oracle Application Testing Suite
  2. ORA-01691: unable to extend lob segment (OTN)
  3. Administering Tablespaces
  4. SQL Purge command
  5. Folllow @OracleAskTom
  6. Oracle Load Testing Overview
  7. Oracle Test Manager Overview

Thursday, July 4, 2013

Shared Memory Size - This Is a Prerequisite Condition Tested during Oracle Installation

During the "Prerequisite Checks" of Oracle Database 11g installation[1], one of three issues we have seen is:
  • Shared memory Size

Detailed Message

This is a prerequisite condition to test whether the OS kernel parameter "shmmax" is properly set.(more details)
Expected Value
:Current=4294967296; Configured=4294967296
Actual Value
:Current=2147483648; Configured=2147483648

shmmax & shmall


For Oracle 11g, the following kernel parameters have to be set to values greater than or equal to the recommended values which can be changed in the proc file system:
  • shmmax
    • The maximum size of a shared memory segment
  • shmall[2]
    • This parameter sets the total amount of shared memory pages that can be used system wide. Hence, shmall should always be at least 
      • ceil ( shmmax / PAGE_SIZE).
In some early versions of the kernel, this needed to be changed and the kernel rebuilt. Since the 2.2 version of the kernel, it can be changed while the system is running with commands like

#echo "4294967296" >/proc/sys/kernel/shmmax 
#echo "1048576" >/proc/sys/kernel/shmall

would set it to 4GB.  Note that we also set shmall to be 1M pages.  You can find the size of page by using:

# getconf PAGE_SIZE
4096

Also note that this needs to be done after each boot.  So, you want to control this at boot by using sysctl. You can place entries in /etc/sysctl.conf like:

kernel.shmmax=4294967296
kernel.shmall=1048576

which will be processed at your next reboot and set it to 4GB, 4 * 1024*1024*1024. Larger values are supported. Check the manuals that came with your Linux distribution[3].

More Information


Oracle uses shared memory for implementing the SGA, which needs to be visible to all database sessions.  On OTN, it recommends setting shmmax to be:
  • SHMMAX= max value of shared memory segment = 0.5 * size of physical memory

For servers running Oracle Fusion Applications, shared memory are also needed for Java heap.  It is recommended that your shared memory segment be larger than the Java heap size.

To determine your physical memory size, you use:
  • #cat /proc/meminfo | grep MemTotal
    MemTotal:     148425832 kB
In summary, you can use the following commands to manage shared memory:
  • To view current settings, run command: 
    • # more /proc/sys/kernel/shmmax
  • To set it to a new value for this running session, which takes effect immediately, run command: 
    • # echo 4294967296 > /proc/sys/kernel/shmmax
  • To have the changes to survive reboot, modify the /etc/sysctl.conf file:
    • kernel.shmmax = 4294967296

References

  1. Installing Oracle Database 11g Release 2
  2. Meaning of SHMALL kernel variable
  3. Verifying Kernel Parameters (Redhat)
  4. How I Simplified Oracle Database Installation on Oracle Linux (Good)
  5. Kernel Configuration
  6. Linux Tuning Parameters



Tuesday, February 19, 2013

Oracle: How to Configure User Accounts to Never Expire?

I have written an article on how to unlock a user account when it expires:
But, every 180 days, you need to repeat the same action.  If you are NOT concerned with strict security rules for your database, you can take the following approach to set user accounts to never expire.

What Profile Used by a User Account?


A profile[3] is a database object - a named set of resource limits. Using profile, you can enforce a limit on resource utilization using resource limit parameters Also you can maintain database security by using password management feature.  Here is the SQL command you can use to query which profile is used by each user account:

SQL>  SELECT USERNAME, PROFILE FROM DBA_USERS;

USERNAME                       PROFILE
------------------------------ ------------------------------
OAM_OAM                        DEFAULT
OAM_IAU_APPEND                 DEFAULT
OAM_IAU_VIEWER                 DEFAULT
OAM_IAU                        DEFAULT
OIM_SOAINFRA                   DEFAULT
OIM_ORASDPM                    DEFAULT
OIM_MDS                        DEFAULT
OIM_OIM                        DEFAULT

As shown above, both OAM and OIM user accounts use "DEFAULT" profile.

What Limits Set with a Profile?


We are only interested in "DEFAULT" profile and resource of PASSWORD type.  To query all sorts of limits imposed with "DEFAULT" profile, you do the following query:

SQL> select resource_name, limit from dba_profiles where profile='DEFAULT' and resource_type='PASSWORD';

RESOURCE_NAME                    LIMIT
-------------------------------- ----------------------------------------
FAILED_LOGIN_ATTEMPTS            10
PASSWORD_LIFE_TIME               180
PASSWORD_REUSE_TIME              UNLIMITED
PASSWORD_REUSE_MAX               UNLIMITED
PASSWORD_VERIFY_FUNCTION         NULL
PASSWORD_LOCK_TIME               1
PASSWORD_GRACE_TIME              7

As shown above, all our OAM and OIM user accounts will expire in 180 days.  However, we would like to set it to never expire.  

How to Set User Password to Never Expire?


Here is the alter statement that you can use:

SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

Profile altered.

The above command has set password life time associated with "DEFAULT" profile to be unlimited.  You can verify the setting by:

SQL> select resource_name, limit from dba_profiles where profile='DEFAULT' and resource_type='PASSWORD';

RESOURCE_NAME                    LIMIT
-------------------------------- ----------------------------------------
FAILED_LOGIN_ATTEMPTS            10
PASSWORD_LIFE_TIME               UNLIMITED
PASSWORD_REUSE_TIME              UNLIMITED
PASSWORD_REUSE_MAX               UNLIMITED
PASSWORD_VERIFY_FUNCTION         NULL
PASSWORD_LOCK_TIME               1
PASSWORD_GRACE_TIME              7

7 rows selected.

References

Monday, February 18, 2013

"The Listener Supports No Services" and Using "Alter System Register" Command

We have started oracle database, which is followed by starting the listener.  Then we checked listener's status.  As you can see below, at beginning, it reports that "The listener supports no services."  However, after exactly 60 seconds, it reports that two services were supported (i.e., ps6stg7 and ps6stg7XDB).

In this article, we explain what happened and will show you how to force service be registered with the listener.  So, your application can find the services sooner.

-bash-3.2$ $ORACLE_HOME/bin/lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-FEB-2013 21:07:57

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                17-FEB-2013 21:06:58
Uptime                    0 days 0 hr. 0 min. 58 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /scratch/aime1/app/oracle11.2.0.3.0/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /scratch/aime1/app/oracle11.2.0.3.0/diag/tnslsnr/myserver/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myserver.us.oracle.com)(PORT=1521)))
The listener supports no services
The command completed successfully
-bash-3.2$ $ORACLE_HOME/bin/lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-FEB-2013 21:07:59

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                17-FEB-2013 21:06:58
Uptime                    0 days 0 hr. 1 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /scratch/aime1/app/oracle11.2.0.3.0/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /scratch/aime1/app/oracle11.2.0.3.0/diag/tnslsnr/myserver/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myserver.us.oracle.com)(PORT=1521)))
Services Summary...
Service "ps6stg7" has 1 instance(s).
  Instance "ps6stg7", status READY, has 1 handler(s) for this service...
Service "ps6stg7XDB" has 1 instance(s).
  Instance "ps6stg7", status READY, has 1 handler(s) for this service...
The command completed successfully

PMON


In our case, we have executed the following shell commands in a script named startDB.sh:

#!/bin/bash
. /scratch/aime1/scripts/db/setEnvPs6stg7.sh

echo "### Restart Oracle databse instance $ORACLE_SID ###"
$ORACLE_HOME/bin/sqlplus / as sysdba << EOF
startup;
EOF
echo "Done"

echo "### Starting tns listener ###"
$ORACLE_HOME/bin/lsnrctl start
sleep 20;
$ORACLE_HOME/bin/lsnrctl stat

However, when the last listener status command was executed, it showed:
"The listener supports no services."

Then I did some research and found out that what happened behind the scene is that:  PMON process wakes up at every 60 seconds and provide (or register) information to the listener.  So, not until 60 seconds later, did listener's status show it supported two services.

Alter System Register


Without waiting for 60 seconds, you can use 
  • alter system register command
This command forces the registration of database information to the listener.  So, I decided to give it a try and I added the new sql command in my script as follows:

$ORACLE_HOME/bin/sqlplus / as sysdba << EOF
startup;
alter system register;
EOF

However, this didn't work.  After some detective works, finally I have figured out that I need to start the listener first before starting the database.  In other words, when the command tried to manually register server information with the listener.  The listener needs to be up and running.  So, after I have moved "lsnrctl start" command before the database start command, it then worked.  Also, you don't need to sleep for 20 seconds before checking the listener's status.

References

Sunday, January 27, 2013

Creating the Required Schemas for Oracle Fusion Middleware Using RCU

To create required schema for Oracle Fusion Middleware[1], you can use Repository Creation Utility (RCU)[2]. You can also use RCU to drop component schemas.  In this article, we will show you how to create schema for the component named OID and discuss the significance of schema prefix.

Repository Creation Utility


Repository Creation Utility (RCU) is a Java tool to create database schema for component schemas that are part of Oracle Fusion Middleware.  RCU is available only on 32-bit x86 Linux and 32-bit Microsoft Windows Operating System platforms. You can run RCU from these machines to connect to any certifed versions of Oracle, or Microsoft SQL Server database, in order to create the schemas required by Fusion Middleware components.

Preparations and Prerequisites


If you are creating schemas on an Oracle database, you must use a user with SYSDBA privileges such as SYS[3].

Here is the outline of instructions of creating new schemas:
  1. Start up your database instance (i.e., ATGOID)
  2. Start tns listener
  3. Download the RCU and unzip it
  4. Open the RCU by invoking rcu in the bin folder
  5. Create component schemas as shown in the next section


Steps


The following sequence takes place when a schema is created with RCU (note that highlighted portion is the option that we have chosen for our installation):
  1. Welcome
  2. Create Repository
    • Create
      • Create and load component schemas into a database
    • Drop
      • Remove component schemas from a database
  3. Database Connection Detail
    • See Figure 1
    • Make sure prerequisite step 1 &2 were executed first.  Otherwise, you will see the following messages:
      • Unable to connect to the database using the provided details.
        Please enter a valid hostname and port or check if the listener is up and running.
    • When you click on Next, Checking Prerequisites window will be displayed (see Figure 1)
      • Prior to the schema being created, RCU performs global and component level prerequisite checks to ensure that certain minimum requirements are met.
    • You may see warning such as:
      • The database you are connecting is with non-AL32UTF8 character set. Oracle strongly recommends using AL32UTF8 as the database character set.
  4. Select Components
    • See Figure 2
      • Select an existing Prefix
      • Create a new Prefix: (Leave it empty; see why in next section)
    • When you click on NExt, Checking Component Prerequisites window will be popped up
  5. Schema Password
    • Enter the passwords for the main and auxiliary schema users.
      • Use same passwords for all schemas
      • Use main schema pssswords for auxiliary schemas
      • Specify different passwords for all schemas
    • Component
      • Oracle Internet Directory (Owner: ODS)
      • Auxiliary Schema (Owner: ODSSM)
  6. Map Tablespaces
    • Choose tablespaces for selected components (Default)
  7. Summary
    • Database details
      • Host Name: myserver
      • Port: 1521
      • Service Name: ATGOID
      • Connected As: sys
      • Operation: Create
      • Prefix for (non-prefixable) Schema Owners : DEFAULT_PREFIX
      • Component
        • Name: Oracle Internet Directory
        • Schema Owner: ODS
        • Tablespace Name:
          • Default: OLTS_DEFAULT
          • Temp: IAS_TEMP
          • Additional:
            • OLTS_ATTRSTORE
            • OLTS_BATTRSTORE
            • OLTS_CT_STORE
            • OLTS_SVRMGSTORE
  8. Completion Summary
    • RCU Logfile: $ORACLE_BASE/logdir.2013-01-15_11-03/rcu.log
    • Component Log Directory: $ORACLE_BASE/logdir.2013-01-15_11-03
    • Status: Success

Schema Prefix


You can use RCU to create multiple schemas of each component using custom prefixes. The prefix is prepended to and separated from the schema name with an underscore (_) character, as shown below:
  • prefix_schemaname
However, the Oracle Internet Directory (ODS) component cannot be prepended with a custom prefix because there can only be one repository for this component per database.  That's why we said that leave the new prefix empty at step 4 above.

The default prefix used by RCU is DEV.  If DEV has already been used, then RCU will default to DEV1, then DEV2, and so on. Prefixes are used to create and organize logical groups of schemas. For example, you may want to create a test version of the Metadata Services (schema name MDS) called TEST_MDS.  Then, when are ready for your production version, you can create a second version of the schema called PROD_MDS. Both TEST_MDS and PROD_MDS may reside on the same or separate databases.

You are only allowed to use a prefix once per schema within a single database. For example, if you had a version of the Metadata Services schema called DEV_MDS, then you can not use the DEV prefix again to create another version of the Metadata Services schema (for example, DEV_MDS2).  If you want to create another version of the schema using the same prefix, you must first drop the existing schema and then create the schema again.

Finally, the mapping between the prefixes and schemas is maintained in schema_version_registry.


SQL> select comp_id,mrc_name from SCHEMA_VERSION_REGISTRY;
COMP_ID                        MRC_NAME                       
------------------------------ ------------------------------ 
OID                            DEFAULT_PREFIX                 
ORASDPM                        DEV                            
SOAINFRA                       DEV                            

3 rows selected

References


  1. Oracle Fusion Middleware Articles
  2. Repository Creation Utility Overview
  3. What’s the Difference between the SYS and SYSTEM Schemas?
  4. Using Custom Prefixes
  5. Oracle Identity and Access manager 11g for Administrators

Saturday, January 26, 2013

Memlock limit too small: 32768 to accommodate segment size: 4194304

In our database alert_<sid>.log, we have found the following warning message:
  • Memlock limit too small: 32768 to accommodate segment size: 4194304
For Oracle to lock shared memory for the shared pool, memlock limit (i.e., locked-in-memory address space) must be large enough.  For example, our system has the following maximum locked-in-memory address space:

# -l     The maximum size that may be locked into memory
$ ulimit -l    
32

Note that the "memlock" figure is specified in Kb.  From the warning, we know our memlock limit needs to be larger than 4194304 bytes.  In reality, it is better to oversize it a little.


How to increase memlock limit on Linux?


Unix operating system can enforce "Limits" the resources a process/user can consume.  Memlock is one of the resource.  On Linux systems, you can adjust the "memlock" parameter in the 

  • /etc/security/limits.conf


For example, this is what we have specified to correct the "memlock-limit-too-small" issue:

#vi /etc/security/limits.conf

@perfgrp    soft    memlock         14680064
@perfgrp    hard    memlock         14680064
*           soft    nofile          65535
*           hard    nofile          65535


In general, individual limits have priority over group limits, so if you impose no limits for admin group, but one of the members in this group have a limits line, the user will have its limits set according to this line. In our case, we specify the group limit for "perfgrp" to be 14680064 bytes. For other users, default values will be applied, which is 65535 bytes. Finally, you need to reboot to make new settings effective.

Consideration for Java Applications


Similar to database software, you also have the same tuning requirement for application running on HotSpot. For example,
  • For all users who will run HotSpot with large pages, you need to set their memlock limit to a value higher than the maximum heap they will run.  This ensures user running the Java application can lock the correct amount of memory.
Of course, the memlock limit to be considered should be based on how much physical memory you have on your systems.  See [1] for details.

References

  1. HugePages Configuration and Monitoring
  2. Large SGA On Linux
  3. How I Simplified Oracle Database Installation on Oracle Linux (Good)
  4. How to Test Large Page Support on Your Linux System

Sunday, January 20, 2013

ORA-03113: end-of-file on communication channel

This article is a follow-up to the previous article:
As pointed out in that article, there are limitations and issues with cloning a database. This article describes one of the issues (see also [234]):
  • ORA-03113: end-of-file on communication channel

ORA-03113


When we tried to startup a cloned database, we saw the following message:

SQL> startup;
ORACLE instance started.

Total System Global Area 1.2827E+10 bytes
Fixed Size                  2240344 bytes
Variable Size            1811939496 bytes
Database Buffers         1.0972E+10 bytes
Redo Buffers               40890368 bytes
Database mounted.
ORA-03113: end-of-file on communication channel
Process ID: 9809
Session ID: 5339 Serial number: 3

It turns out that database has been mounted OK.  But, database failed when it was opened.

ALTER DATABASE OPEN Failed


Oerr is an Oracle utility that extracts error messages with suggested actions from the standard Oracle message files.  Here is the suggested actions from oerr:

$ oerr ORA 03113
03113, 00000, "end-of-file on communication channel"
// *Cause: The connection between Client and Server process was broken.
// *Action: There was a communication error that requires further investigation.
//          First, check for network problems and review the SQL*Net setup. 
//          Also, look in the alert.log file for any errors. Finally, test to 
//          see whether the server process is dead and whether a trace file
//          was generated at failure time.


One of the suggested action is to look in the alert.log file.  To find the location of alert.log, you do:
  1. Find the location of diagnostic destination from the initialization parameter file (i.e., dbs/init<sid>.ora ).  For example, we have this entry:
    • diagnostic_dest=/slot/fiz7865/log
  2. From there, you can find alert.log file in the following sub directory:
    • <diagnostic_dest>/diag/rdbms/<dbname>/<instname>/trace

In the alert_<sid>.log, we have found the following messages:

ALTER DATABASE OPEN
Errors in file /slot/fiz7865/log/diag/rdbms/fiz7865/fiz7865/trace/fiz7865_lgwr_9793.trc:
ORA-00338: log 2 of thread 1 is more recent than control file
ORA-00312: online log 2 thread 1: '/data1/rup3.redolog/log2.dbf'
Errors in file /slot/fiz7865/log/diag/rdbms/fiz7865/fiz7865/trace/fiz7865_lgwr_9793.trc:
ORA-00338: log 2 of thread 1 is more recent than control file
ORA-00312: online log 2 thread 1: '/data1/rup3.redolog/log2.dbf'
Errors in file /slot/fiz7865/log/diag/rdbms/fiz7865/fiz7865/trace/fiz7865_ora_9809.trc:
ORA-00338: log 1 of thread  is more recent than control file
ORA-00312: online log 2 thread 1: '/data1/rup3.redolog/log2.dbf'
USER (ospid: 9809): terminating the instance due to error 338

What Happened?


As stated in ORA-00338, our redo log file is more recent than control file.  This happened because we have cloned control files first and then cloned redo files only after we have found that they were missing.  Note that in between two cloning, we have also restarted our source database.  So, after we have synchronized the control files and the redo files, we were able to start up database successfully.  In the alert.log file, you should find the following messages:

ALTER DATABASE OPEN
Thread 1 opened at log sequence 371
  Current log# 2 seq# 371 mem# 0: /data1/rup3.redolog/log2.dbf
Successful open of redo thread 1

References

  1. Simplify Cloning by Using Hosts File
  2. ORA-00313: open failed for members of log group 1 of thread 1
  3. Using rsync to Clone Local and Remote Systems
  4. ORA-01031: insufficient privileges
  5. Migrating Oracle B2B from Test to Production (T2P) (Chap 10 of the Book "Getting Started with Oracle SOA B2B Integration: A Hands-On Tutorial")
    • This section provides a real-world scenario to replicate (clone) the test environment to production for Oracle SOA.
    • Oracle Fusion Middleware provides a series of scripts for this task.
  6. Oracle Products: What Patching, Migration, and Upgrade Mean? (Xml and More)
    • For your Oracle production systems, follow official recommendations as shown in this article.

Tuesday, January 15, 2013

Using Database Configuration Assistant to Create Additional Databases

During Oracle Database installation, if you choose to create a starter database (see also [1]), Oracle Universal Installer automatically runs Database Configuration Assistant (DBCA) after software installation is complete. DBCA then guides you through the steps to create the database.

If you do not create a starter database and later want to create one, or if you want to create additional databases, then you use DBCA.  The Database Configuration Assistant enables you to
  • Create a database
  • Configure database options in an existing database
  • Delete a database
  • Manage database templates

There may be situations in which you want to create more than one Oracle database on the same host 
computer. When you do this with DBCA, the new databases typically  use the same Oracle home directory as the first database, but store database data files separately from those of the first database.

In [1], we describe the steps that we used to install a starter database with a Global Database Name (GDNSTAGE7.  In this article, we will show how to add a new database (GDN: ATGOID) in the same Oracle home directory.


Steps


Here are our steps to create a new database named ATGOID using DBCA.  Note that highlighted options are our selections.  For more detailed descriptions, read [2].
  1. Welcome
  2. Operations
    • Select the operation that you want to perform:
      • Create a Database
      • Configure Database Options
      • Delete a Database
      • Manage Tempaltes
    • ASM configuration operations must be performed using Automatic Storage Management Configuration Assistant (ASMCA) from Oracle Grid Infrastructure home.
  3. Database Templates
    • Select template to use for creation
      • General Purpose or Transaction Processing
      • Custom Database
      • Data Warehouse
  4. Database Identification
    • See Figure 1 (note that we didn't specify domain name here)
    • Global Database Name: ATGOID
    • SID: ATGOID
  5. Management Options
    • Uncheck "Configure Enterprise Manager"
    • We don't need this option for our benchmark
  6. Database Credentials
    • Specify passwords for the following user accounts in the new database:
      • SYS
      • SYSTEM
  7. Network Configuration
    • Select the listeners for which you want to register this database:
      • Register this database with all the listeners
      • Register this database with selected listeners only
    • Note that we have created a new listener ATGOID using Net Configuration Assistant[3]
  8. Database File Locations
    • Specify storage type and locations for database files:
      • Storage Type: File System
      • Storage Locations:
        • Use Database File Locations from Template
        • Use Common Location for All Database Files
        • Use Oracle-Managed Files
  9. Recovery Configuration
    • Specify Fast Recovery Area (Default)
  10. Database Content
    • Default
  11. Initialization Parameters
    • Typical (Default)
  12. Database Storage
    • You can specify storage parameters for database creation.  (Default)
  13. Creation Options
    • Select the database creation options
      • Create Database
      • Save as a Database Template
      • Generate Database Creation Scripts
    • Generate Database Creation Scripts

Log File Location


Log files for the current operation are located at:
  • $ORACLE_BASE/cfgtools/dbca/ATGOID

What to Expect?


After the creation of a new database, you should find the following information:
Database Information:
Global Database Name: ATGOID
System Identifier(SID): ATGOID
Server Parameter File name:  $ORACLE_HOME/dbs/spfileATGOID.ora

If you look into initATGOID.ora, you can also find the following two entries:
*.db_domain=''
*.db_name='ATGOID'
Note that the domain name is an empty string because we didn't provide domain name at step 4.

References

  1. Installing Oracle Database 11g Release 2
  2. Oracle® Database 2 Day DBA 11g Release 1 (11.1)
  3. Using Net Configuration Assistant to Configure a Listener

Monday, January 14, 2013

Using Net Configuration Assistant to Configure a Listener

Oracle Net Configuration Assistant (i.e., netca[1] is provided to configure basic network components during database installation[2], including:
  • Listener names and protocol addresses
  • Naming methods the client will use to resolve connect identifiers to connect descriptors
  • Net service names in a tnsnames.ora file 
  • Directory server usage
netca runs automatically during database software installation, as described in your Oracle installation guide.  It can also be run after installation in standalone mode to configure the above-described components in a similar way that is provided during installation.

In this article, we will show you how to configure a new listener named ATGOID using netca.

Running Net Configuration Assistant


Configuration files are typically created in
  • UNIX
    • $ORACLE_HOME/network/admin
  • Windows
    •  %ORACLE_HOME%\network\admin
However, configuration files can be created in a variety of places.  To make sure, the correct configuration files are updated, you can set TNS_ADMIN environment variable on Unix:
  • $ export TNS_ADMIN=/export/home/oracle/atg/Oracle11gR2/product/11.2.0/dbhome_1/network/admin
You also need to specify ORACLE_HOME:
  • $export ORACLE_HOME=/export/home/oracle/atg/Oracle11gR2/product/11.2.0/dbhome_1

Log on to your computer as a member of the administrative group that is authorized to install Oracle software and create and run the database.  To start Oracle Net Configuration Assistant:
  • UNIX
    • Run netca from $ORACLE_HOME/bin
  • Windows
    • Choose Start > Programs > Oracle - HOME_NAME > Configuration and Migration Tools > Net Configuration Assistant


Configuration Steps


Here are our steps to configure a new listener named ATGOID using netca.  Note that highlighted options are our selections.
  1. Welcome
    • Choose the configuration you would like to do:
      • Listener configuration
      • Naming Methods configuration
      • Local Net Service Name configuration
      • Directory Usage Configuration
  2. Listener Configuration, Listener
    • Select what you want to do:
      • Add
      • Reconfigure
      • Delete
      • Rename
  3. Listener Configuration, Listener Name
    • Listener name: ATGOID
  4. Listener Configuration, Select Protocols
    • See Figure 1
  5. Listener Configuration, TCP/IP Protocol
    • Which TCP/IP port number should the listener use? (Default)
  6. Listener Configuration, IPC Protocol
    • To communicate with the database using the IPC protocol, an IPC key value is required.
    • IPC Key value: EXTPROC1522
  7. Listener Configuration, More Listeners
    • Would you like to configure another listener? (No)
  8. Listener Configuration, Select Listener
    • Select a listener you want to start: ATGOID
  9. Listener Configuration Done

Log location


In case there is error found during configuration, you can find more details from the log files located here:
  • $ORACLE_HOME/cfgtoollogs/netca

For example, we have found two files in there:


$ORACLE_HOME/cfgtoollogs/netca
$ ls -lrt
total 60
-rw-r--r-- 1 oracle oinstall 52023 Jan 14 16:49 trace-13011512AM2431.log
-rw-r--r-- 1 oracle oinstall   371 Jan 14 16:49 netca-13011512AM2431.log

Console Ouput


If the configuration succeeded, you should find the following messages from the console:

$ ./netca 

Oracle Net Services Configuration:
Configuring Listener:ATGOID
Listener configuration complete.
Oracle Net Listener Startup:
    Running Listener Control: 
      /export/home/oracle/atg/Oracle11gR2/product/11.2.0/dbhome_1/bin/lsnrctl start ATGOID
    Listener Control complete.
    Listener started successfully.
Oracle Net Services configuration successful. The exit code is 0

listener.ora


After the configuration, configuration file listener.ora located in $TNS_ADMIN folder will be updated.  This configuration file for the  listener may include:
  • Protocol addresses it is accepting connection requests on
  • Database and nondatabase services it is listening for
  • Control parameters used by the listener
In our case, two entries were added in listener.ora:

ATGOID =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
      (ADDRESS = (PROTOCOL = TCP)(HOST = myserver.oracle.com)(PORT = 1521))
    )
  )

ADR_BASE_ATGOID = /export/home/oracle/atg/Oracle11gR2


References

Sunday, January 13, 2013

Cloning Issue—What If Host Name(s) Are Stored in the Database

This article is a follow-up to the previous article:
As pointed out in that article, there are limitations and issues with cloning—either an application or a database. This article describes one of the issues (see also [23, 4]): when host names are stored in the database tables.

Cloning


In [1], we have outlined the cloning tasks step by step.  In this article, we will discuss one of the cloning issues:
  • If host name(s) are stored in the database tables
To do cloning (see [3]), we need to duplicate a software installation from a source to a destination.  As described in [1], you can use /etc/hosts file to simplify the cloning task by redirecting host name resolution on Linux. However, if the host name is stored in the database table and not yet listed in the hosts file, your application can still fail.

In the following section, we will describe one use case that showcases this issue.

ADF Task Flow


A user would like to change the host name of a Redhat Linux which hosts SOASuite and WebCenter.  After following the approach as described in [1] using hosts file.  He found out that his workflow still wasn't working correctly.

When he opened a task, the browser tried to connect to:

and he has found that localhost.localdomain still pointed to the previous host.  Now the server doesn't know how to resolve this name and asks browsers to connect to that host.

After some diggings, he has finally identified that there is a setting in the WFTASKDISPLAY table of SOAINFRA schema, which still keeps the previous host name.  Presumably, when a task was deployed, previous host name was stored there and caused the malfunction of his ADF task flow.

To be honest, this is a case reported by another user.  So, I might have described it wrong.  However, it does point out a potential problem—if you have renamed a server and some other servers may not recognize that old name anymore because the old host name is stored in the database.  So, you need to change hosts file on those machines too to redirect the mapping of the old name to the new IP address.

References

  1. Simplify Cloning by Using Hosts File
  2. ORA-00313: open failed for members of log group 1 of thread 1
  3. Using rsync to Clone Local and Remote Systems
  4. ORA-01031: insufficient privileges
  5. Migrating Oracle B2B from Test to Production (T2P) (Chap 10 of the Book "Getting Started with Oracle SOA B2B Integration: A Hands-On Tutorial")
    • This section provides a real-world scenario to replicate (clone) the test environment to production for Oracle SOA.
    • Oracle Fusion Middleware provides a series of scripts for this task.
  6. Oracle Products: What Patching, Migration, and Upgrade Mean? (Xml and More)
    • For your Oracle production systems, follow official recommendations as shown in this article.



Wednesday, January 9, 2013

ORA-01031: insufficient privileges

This article is a follow-up to the previous article:
As pointed out in that article, there are limitations and issues with cloning (either an application or a database). This article describes one of the issues (see also [2, 3]) when you clone a database.

Cloning


In [1], we have outlined the cloning tasks step by step.  In this article, we will discuss:
  • How to resolve "ORA-01031: insufficient privileges"
  • What is config.c
To do cloning (see [3]), we need to duplicate a software installation from a source to a destination by preserving its path structure and as the same UNIX user (say "oracle").  However, the same UNIX user can have different effective group ID's in the source and destination servers and this can cause issue such as ORA-01031.

ORA-01031


When we invoked "sqlplus / as sysdba" from the cloned environment, we have seen:

ERROR:
ORA-01031: insufficient privileges


When you clone a database, there could be differences in UNIX user/group setup between source server and destination server.

For example, our source server has the following user/group settings for the sqlplus executable:

-rwxr-x--x 1 oracle oracle 9221 Dec  5 01:25 /export/home/oracle/atg/Oracle11gR2/product/11.2.0/dbhome_1/bin/sqlplus

but, our destination server has different user/group settings for it:

-rwxr-x--x 1 oracle oinstall 9221 Dec  5 01:25 /export/home/oracle/atg/Oracle11gR2/product/11.2.0/dbhome_1/bin/sqlplus

To look into this issue, you can  check the UNIX group ID defined for sqldba adminstrative access in:
  • $ORACLE_HOME/rdbms/lib/config.c

config.c


When you see the following error:
ORA-01031: insufficient privileges

you want to check config.c if your password file is ok and the group is correct for the Oracle account (i.e., "oracle").  This file tells you which UNIX group ID is assigned for sqldba administrative access by this Oracle Installation.


This is the content of config.c from source server:

/*  SS_DBA_GRP defines the UNIX group ID for sqldba adminstrative access.  */
/*  Refer to the Installation and User's Guide for further information.  */

/* IMPORTANT: this file needs to be in sync with
              rdbms/src/server/osds/config.c, specifically regarding the
              number of elements in the ss_dba_grp array.
 */

#define SS_DBA_GRP "oracle"
#define SS_OPER_GRP ""
#define SS_ASM_GRP ""

char *ss_dba_grp[] = {SS_DBA_GRP, SS_OPER_GRP, SS_ASM_GRP};

However, this is the content of config.c from another working Oracle instance on destination server:

/*  SS_DBA_GRP defines the UNIX group ID for sqldba adminstrative access.  */
/*  Refer to the Installation and User's Guide for further information.  */

/* IMPORTANT: this file needs to be in sync with
              rdbms/src/server/osds/config.c, specifically regarding the
              number of elements in the ss_dba_grp array.
 */

#define SS_DBA_GRP "dba"
#define SS_OPER_GRP "oper"
#define SS_ASM_GRP ""

char *ss_dba_grp[] = {SS_DBA_GRP, SS_OPER_GRP, SS_ASM_GRP};

From the differences, we know that our cloned Oracle binary expects "oracle"  UNIX group ID for sqldba adminstrative access.   However, our "oracle" UNIX user belongs to the following UNIX groups:

  • oinstall
  • dba
  • oper
but, not "oracle".

$id
uid=507(oracle) gid=507(oinstall) groups=507(oinstall),8500(dba),8501(oper)

Solution


One way to resolve this issue is to create a new group named "oracle" on our destination server.  So, we have created a new group named "oracle" and add our "oracle" user to the "oracle" group (as a "root" user):


#groupadd -g 8502 oracle
#usermod -G oinstall,dba,oper,oracle oracle


For more information, read [4, 5].

References

  1. Simplify Cloning by Using Hosts File
  2. ORA-00313: open failed for members of log group 1 of thread 1
  3. Using rsync to Clone Local and Remote Systems
  4. Thread: ORA-01031: insufficient privileges While trying / as sysdba
  5. Creating and Maintaining a Password File
  6. ORA-27101: shared memory realm does not exist tips
  7. Migrating Oracle B2B from Test to Production (T2P) (Chap 10 of the Book "Getting Started with Oracle SOA B2B Integration: A Hands-On Tutorial")
    • This section provides a real-world scenario to replicate (clone) the test environment to production for Oracle SOA.
    • Oracle Fusion Middleware provides a series of scripts for this task.
  8. Oracle Products: What Patching, Migration, and Upgrade Mean? (Xml and More)
    • For your Oracle production systems, follow official recommendations as shown in this article.

Monday, January 7, 2013

Global Database Name in Oracle Database 11g

When you install a new Oracle Database (see [1]), you are asked to provide the Global database name as shown below:


In a distributed database system, each database should have a unique global database name. Global database names uniquely identify a database in the system. For example, if global naming is enforced by the remote database, you must use the remote database global database name as the name of the database link that you are creating.

In this article, we will examine the following topics:
  • How to check if global naming is enforced?
  • How to view different names?
  • How to change the domain name in a global database name?

How to check if global naming is enforced?


To determine whether global naming on a database is enforced on a database, you can either examine the database initialization parameter file or query the V$PARAMETER view. For example, to see whether global naming is enforced on the remote database, you could start a session on the remote database and then create and execute the following globalnames.sql script (sample output included):

COL NAME FORMAT A12
COL VALUE FORMAT A6
SELECT NAME, VALUE FROM V$PARAMETER
   WHERE NAME = 'global_names'
/

SQL> @globalnames

NAME         VALUE
------------ ------
global_names FALSE


Note that global naming is not enabled by default when you install a new Oracle database.  In other words, you won't find the parameter global_names in the new initialization parameter file.

Global Database Name


In our installation, we have used "orcl.us.oracle.com" as the global  database name, which is composed of two components:
  • DB_NAME
    • "orcl"
  • DB_DOMAIN
    • "us.oracle.com"  (must follow standard Internet conventions)
You can find this piece of information in your initialization parameter file:

*.db_domain='us.oracle.com'
*.db_name='orcl'

How to query different names?


If a database instance is created, you should be able to find out all different names from the data dictionary:
  • DB_NAME
    • SQL> select name from v$database;

      NAME
      ---------
      ORCL

  • DB_DOMAIN
    • SQL> SELECT NAME, VALUE FROM V$PARAMETER WHERE NAME = 'db_domain';

      NAME      VALUE
      --------- -----------
      db_domain us.oracle.com
  • GLOBAL_NAME
    • SQL>SELECT * FROM GLOBAL_NAME;

      GLOBAL_NAME
      -------------------
      ORCL.US.ORACLE.COM

How to change domain name?


The db_domain initialization parameter is only important at database creation time when it is used, together with the db_name parameter, to form the database global name. At this point, the database global name is stored in the data dictionary. You must change the global name using an ALTER DATABASE statement, not by altering the db_domain parameter in the initialization parameter file. It is good practice, however, to change the db_domain  arameter to reflect the change in the domain name before the next database startup.

For more details on how to change the domain in a global database name, you can read [2].

References

  1. Installing Oracle Database 11g Release 2
  2. Managing Global Names in a Distributed System
  3. How to Change DB_NAME & ORACLE_SID
  4. Using Database Configuration Assistant to Create Additional Databases
  5. Using Net Configuration Assistant to Configure a Listener

© Travel for Life Guide. All Rights Reserved.

Analytical Insights on Health, Culture, and Security.