Kamran Agayev's Oracle Blog

Oracle Certified Master

ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated Bind

Posted by Kamran Agayev A. on November 19th, 2012

Today, when I was using BULK COLLECT to fetch some rows to the collection, I got the following error:

ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated Bind

I checked my code and didn’t find anything special that can cause this error. After investigating a while, I found that the row which has length more than 2000 bytes causes that error. I checked my collection and saw that this row was defined as – dbms_sql.varchar2_table

What do you think, how it was defined in the package level (DBMS_SQL)? I was thinking it was defined as “VARCHAR2(4000)“, but it was “VARCHAR2(2000)“.

type Varchar2_Table is table of varchar2(2000) index by binary_integer;

So I declared new variable, changed the declaration of my collection as follows and it worked:

type Varchar4000_Table is table of varchar2(4000) index by binary_integer;

TYPE trec  IS RECORD (

…..

…..

column Varchar4000_Table;

)

Posted in Administration, SQL and PL/SQL | 2 Comments »

Do you backup your blog?

Posted by Kamran Agayev A. on November 12th, 2012

Last month I got an email from wordpress.com that my password was changed. Hmm … I opened the browser and tried to login to my page, but password was incorrect! I resetted my password and asked wordpress to send me a new password to my email, but I didn’t get it. Ohh .. The password was changed and sent to the hacker’s email! I checked my webpage and got “hacked” message. The hacker get into my wordpress database (either due to wordpress plugin bug or hosting security hole)

I called hosting service and asked them to check my webpage and recover it back immediately! It took more than 2 hours to recover my blog.

In my opinion, getting your webpage hacked is not a big deal, the big deal is if you don’t have backup of your blog! Can you imagine what happened if I lost my blog which contains 140 technical posts with 1983 Comment? Your blog is your career. If you lost it, you can lose your career.

I would advice you to have backup of your blog (don’t rely to hosting backup, make backup after each blog post you post, copy the backup to the different storage), to not use unnecessary and untested wordpress plugins and to choose the one of the best hostings in the market

Posted in Uncategorized | 2 Comments »

APAC OTN Tour 2012 – Thailand, Bangkok – OUGTH

Posted by Kamran Agayev A. on November 8th, 2012

Two months ago I was invited by my friend, an Oracle ACE Director – Francisco Munoz Alvarez to present at APAC OTN Tour this year. My papers were accepted for Thailand Oracle User Group (OUGTH) meeting. I was very excited as it was my first time to present at OUGTH

At Bangkok airport, I was met by my Azerbaijani friend, Ibrahim Jabbari, who helped me a lot when I was at Bangkok.

At the next day, I got up early, have a wonderful breakfast at the hotel and went to the Eastin Grand Hotel Sathorn for the conference where I was met warmly by OUGTH staff. After a while Francisco and Mike Dietrich arrived.

It was my pleasure to meet Francisco in person  and present with him in the same conference. He has a very deep knowledge of Oracle and he’s doing a great job for the Oracle community. Francisco talked about Database Security and showed some magics with Oracle in real life scenario

Mike, who works Upgrade Consultant for Oracle, presented three sessions in this conference. Two of them were related with Database upgrade, the last one was related with Data Pump which was very interesting. I must say that I haven’t seen such guy who has very strong knowledge of Oracle Upgrade issues in my whole DBA career.

Then I talked about RMAN 11g new features and showed some pre-created video tutorials

Then Thai DBA, Tanakorn talked about Constraints in Thai language, although I didn’t understand anything :), the presentation was prepared good

At the end, we took some photos together with OUGTH staff. You can find some of pictures from the following link:

http://oracle.in.th/?p=11691

To see my updated during the conference, check my twitter account:

https://twitter.com/KamranAgayev

I would like to thank to OTN and OUGTH for organizing this event and wish to present at Bangkok again next year :)

Here’re some pictures I’ve taken at conference and at Bangkok


Posted in Uncategorized | No Comments »

You get CRITICAL failure each time you use DBCA to create a database

Posted by Kamran Agayev A. on August 28th, 2012

Do you know you get database failure each time when you create a new database with DBCA? 

Today, while testing troubleshooting Data Recovery Advisor (DRA) I saw an interesting issue. When I queried GV$IR_FAILURE view on the newly created database, I got some rows … This view is used and updated by DRA and Oracle background processes. When Oracle encounter an error such as data bock corruption, missing datafile or controlfile and etc. , it automatically updates the mentioned view. But how it’s possible to get an error on newly created database when no operation is performed.

Here’s the output from this view:

SQL> set linesize 150

SQL> col description format a35

SQL> col impacts format a30

SQL> select failure_id, to_char(time_detected,’dd.mm.yyyy hh24:mi:ss’) time_detected, modified, description, impacts, priority, status from GV$IR_FAILURE;

FAILURE_ID TIME_DETECTED       MODIFIED  DESCRIPTION                         IMPACTS                        PRIORITY STATUS

———- ——————- ——— ———————————– —————————— ——– ————

2 28.08.2012 14:44:57           Control file needs media recovery   Database cannot be opened      CRITICAL OPEN

And in one case I got fou 4 failures :) (one was child failure)

Just want to mention that if you want to know the source of the view “GV$IR_FAILURE”, query v$fixed_view_definition view:

SQL> col view_definition format a70

SQL>  select * from v$fixed_view_definition

where view_name=’GV$IR_FAILURE’;

VIEW_NAME                      VIEW_DEFINITION

—————————— ———————————————————————-

GV$IR_FAILURE                  select inst_id,       id,       pid,       cid_count,       clsname,

cast(ctime as date),       cast(mtime as date),       fdg_msg,

damage_msg,       decode(priority, 0, ‘CRITICAL’,

1, ‘HIGH’,                         2, ‘LOW’,

‘UNKNOWN’),       decode(status, 0, ‘OPEN’,

1, ‘CLOSED’,                       2, ‘UNDER-REPAIR’,

‘UNKNOWN’) from x$dbkfdg    where type = 1 and clsnameid = 2

and bitand(FLAGS,3) = 0

So the original table is – x$dbkfdg

Now let’s go back to our issue. After getting this error on GV$IR_FAILURE view, I logged in to RMAN and run LIST FAILURE command to get the list of failures. Although the failure is logged as “CRITICAL” and the status is “OPEN”, the command returned no result:

RMAN> list backup;

using target database control file instead of recovery catalog

specification does not match any backup in the repository

RMAN>

Then I checked detected time of the failure from the view – GV$IR_FAILURE:

SQL> select to_char(time_detected,’dd.mm.yyyy hh24:mi:ss’) time_detected from GV$IR_FAILURE;

TIME_DETECTED

——————-

28.08.2012 14:44:57

So this means that at the mentioned time we got a critical problem with control file. Then I checked the log file of the database creation for the same time period:

cd /u01/home/oracle/cfgtoollogs/dbca/testdb

vi trace.log

[Thread-55] [ 2012-08-28 14:44:10.243 AZST ] [CloneDBCreationStep.executeImpl:448]  createCTLSql=Create controlfile reuse set database “mydb”

[Thread-55] [ 2012-08-28 14:44:20.299 AZST ] [CloneDBCreationStep.executeImpl:470]  Shutdown database

[Thread-55] [ 2012-08-28 14:44:20.307 AZST ] [CloneDBCreationStep.executeImpl:492]  Startup ……nomount……

[Thread-55] [ 2012-08-28 14:44:49.702 AZST ] [CloneDBCreationStep.executeImpl:511]  Enabling restricted session.

[Thread-55] [ 2012-08-28 14:44:52.062 AZST ] [CloneDBCreationStep.executeImpl:513]  alter database “mydb” open resetlogs;

[Thread-55] [ 2012-08-28 14:45:07.405 AZST ] [CloneDBCreationStep.executeImpl:521]  Removing existing services from sourcedb seeddata

[Thread-55] [ 2012-08-28 14:45:07.733 AZST ] [CloneDBCreationStep.executeImpl:526]  Renaming globale_name

So the error came from “ALTER DATABASE “MYDB” OPEN RESETLOGS” command.

After running ADVISE FAILURE command and the querying the view again, you’ll see that the failure is “solved”, status is CLOSED and MODIFIED columns is updated to the current time:

SQL> select failure_id, to_char(time_detected,’dd.mm.yyyy hh24:mi:ss’) time_detected, to_char(modified,’dd.mm.yyyy hh24:mi:ss’) modified, description, impacts, priority, status from GV$IR_FAILURE;

FAILURE_ID TIME_DETECTED       MODIFIED            DESCRIPTION                         IMPACTS                        PRIORITY STATUS

———- ——————- ——————- ———————————– —————————— ——– ————

         2 28.08.2012 14:44:57 28.08.2012 16:27:06 Control file needs media recovery   Database cannot be opened      CRITICAL CLOSED

Posted in Administration | 8 Comments »

I’m an Oracle ACE Director now!

Posted by Kamran Agayev A. on August 13th, 2012

I would like to share a good news with you which I got two week ago – I was nominated for Oracle ACE Director award! This is the biggest award in my life. It has encouraged me and I feel myself more responsible and will keep contributing to the community

Whatever path you take in your life, you must always find the time to give something back to the community

I would also like to thank Syed Jaffar Hussain, Uwe Hesse and Porus Homi Havewala for nominating me for this award

Posted in Uncategorized | 31 Comments »

TNS-12560: TNS:protocol adapter error

Posted by Kamran Agayev A. on July 31st, 2012

Today, after installing Critical Security Patches, the listeners didn’t start up and I got the following error:

-bash-3.2$ lsnrctl status

LSNRCTL for HPUX: Version 10.2.0.4.0 – Production on 31-JUL-2012 14:24:51

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
HPUX Error: 239: Connection refused

When I tried to start it, I got the following error:

-bash-3.2$ lsnrctl start LISTENER

LSNRCTL for HPUX: Version 10.2.0.4.0 – Production on 31-JUL-2012 14:25:01

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

Starting /home/oracle/product/10gR2/bin/tnslsnr: please wait…

TNS-12547: TNS:lost contact
TNS-12560: TNS:protocol adapter error
TNS-00517: Lost contact
HPUX Error: 32: Broken pipe

Actually I hate these type of unknown and unexplainable errors. After checking metalink notes, I didn’t get any useful information.

As I got the error after patch installation, I tried to relink tns again:

-bash-3.2$ cd $ORACLE_HOME/network/lib

-bash-3.2$ make -f ins_net_server.mk.32 install

Then I started the listener and succeeded :)

Posted in Administration | 2 Comments »

EMD upload error: uploadXMLFiles skipped :: OMS version not checked yet.

Posted by Kamran Agayev A. on July 26th, 2012

I strongly believe if you’ve deployed agents a coupled of times, you’ve encountered the following error after the installation:

[oracle@dg2 bin]$ ./emctl upload agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
—————————————————————
EMD upload error: uploadXMLFiles skipped :: OMS version not checked yet..

 

The first thing that should be done is checking the log file. Switch to the following directory and tail the log file:

cd /u01/oracle/product/10.2.0/agent10g/sysman/log
tail -f emagent.trc

 

Here’s the output from the log file:

2012-07-26 03:46:33 Thread-51022736 ERROR pingManager: nmepm_pingReposURL: Did not receive a response header from repository
2012-07-26 03:47:08 Thread-51022736 ERROR pingManager: nmepm_pingReposURL: Did not receive a response header from repository
2012-07-26 03:47:08 Thread-51022736 ERROR pingManager: nmepm_pingReposURL: Did not receive a response header from repository

 

I checked the status of the agent and saw that it’s running :

[oracle@dg2 bin]$ ./emctl status agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
—————————————————————
Agent Version : 10.2.0.3.0
OMS Version : 10.2.0.3.0
Protocol Version : 10.2.0.2.0
Agent Home : /u01/oracle/product/10.2.0/agent10g
Agent binaries : /u01/oracle/product/10.2.0/agent10g
Agent Process ID : 27772
Parent Process ID : 27755
Agent URL : http://dg2:3872/emd/main/
Repository URL : http://dg1:4889/em/upload/
Started at : 2012-07-26 03:42:04
Started by user : oracle
Last Reload : 2012-07-26 03:42:04
Last successful upload : (none)
Last attempted upload : (none)
Total Megabytes of XML files uploaded so far : 0.00
Number of XML files pending upload : 21
Size of XML files pending upload(MB) : 3.25
Available disk space on upload filesystem : 58.86%
Last attempted heartbeat to OMS : 2012-07-26 03:45:22
Last successful heartbeat to OMS : unknown
—————————————————————
Agent is Running and Ready
[oracle@dg2 bin]$
[oracle@dg2 bin]$

 

So I decided to clear unnecessary files that can’t be uploaded to the Grid Control under the following directories:

$AGENT_HOME/sysman/emd/collection

$AGENT_HOME/sysman/emd/state

$AGENT_HOME/sysman/emd/recv

$AGENT_HOME/sysman/emd/upload

$AGENT_HOME/sysman/emd/lastupld.xml

 

Then stopped the agent, secured it, cleared unnecessary files again with clearstate parameter, started the agent and uploaded.

 

[oracle@dg2 bin]$ ./emctl stop agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
Stopping agent …. stopped.

 
[oracle@dg2 bin]$ ./emctl secure agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
Enter Agent Registration password :
Agent is already stopped… Done.
Securing agent… Started.
Requesting an HTTPS Upload URL from the OMS… Done.
Requesting an Oracle Wallet and Agent Key from the OMS…
Done.
Check if HTTPS Upload URL is accessible from the agent… Done.
Configuring Agent for HTTPS in CENTRAL_AGENT mode… Done.
EMD_URL set in /u01/oracle/product/10.2.0/agent10g/sysman/config/emd.properties
Securing agent… Successful.
[oracle@dg2 bin]$

 
[oracle@dg2 bin]$ ./emctl clearstate agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
EMD clearstate completed successfully
[oracle@dg2 bin]$ ./emctl start agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
Starting agent ….. started.

 
[oracle@dg2 bin]$ ./emctl upload agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
—————————————————————
EMD upload completed successfully

 
[oracle@dg2 bin]$ ./emctl upload agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
—————————————————————
EMD upload completed successfully
[oracle@dg2 bin]$

 

Then I checked Grid Control and made sure that the agent is working

 

Posted in Administration | 6 Comments »

Bypass prerequisite check during automatic silent agent installation

Posted by Kamran Agayev A. on July 26th, 2012

Today, while installing agent I failed again. The reason was that I was trying to install 10gR2 agent on OEL5.5 which is not supported. During the installation I got the following error:

./agentDownload.linux_x64 -b /u01/oracle/product/10.2.0/ -m dg1 -r 4889
Performing check for CertifiedVersions
Checking operating system requirements …
Expected result: One of redhat-3,redhat-4,SuSE-8,SuSE-9,SuSE-10
Actual Result: redhat-5.5
Check complete. The overall result of this check is: Failed <<<<
Check complete: Failed <<<<
Problem: Oracle EnterPrise Manager 10gR2 is not certified on the current operating system.
Recommendation: Make sure you are installing the software on the correct platform.

PrereqChecks complete

Completed with Status=255

[oracle@dg2 tmp]

 

Although I’ve changed /etc/redhat-release file to “redhat-4” I got the above error. So I decided to edit the agentDownload script and make it to bypass the PreRequisite checks

I opened the file and find that the runInstaller is called ExecAgentInstall() procedure. I get down to the line 269 and edit it as follows:

 

Before: ignoreSysPrereqs=${silentPatchCheck:+”-ignoreSysPrereqs”}

After: ignoreSysPrereqs=”-ignoreSysPrereqs use_prereq_checker=false “

 

Here’s the output from the documentation related with this parameter:

USE_PREREQ_CHECKER This is used to specify if the prereq checker is to be used during the installation or not. The value for this variable is set based on the value in the oraparam.ini.

 

Then I saved the file and run the first command again. Fortunately it bypassed the PreRequisite check and installation finished successfully

 

Installation in progress (Thu Jul 26 03:34:46 AZST 2012)
……………………………………………………… 39% Done.
……………………………………………………… 78% Done.
Install successful

 

 

Posted in Administration | 2 Comments »

404 Not Found – during Grid Control Agent Deployment

Posted by Kamran Agayev A. on July 26th, 2012

I’ve wrongly installed 64 bit Oracle 10g Grid Control installation on 32 bit Linux. The installation went smooth, but while trying to deploy an agent on the different host, I got the following error:

Resolving dg1… 192.168.153.128

Connecting to dg1|192.168.153.128|:4889… connected.
HTTP request sent, awaiting response… 200 OK
Length: 19533 (19K)

[text language=”/plain”][/text]


Saving to: `agent_download.rsp’

100%[======================================>] 19,533 –.-K/s in 0s

2012-07-25 23:43:32 (91.2 MB/s) – `agent_download.rsp’ saved [19533/19533]

Finished Downloading with Status=0
Downloaded response with status=0
Downloading Oracle Installer …
–2012-07-25 23:43:32– http://dg1:4889/agent_download/10.2.0.3.0/linux/oui/oui_linux.jar
Resolving dg1… 192.168.153.128
Connecting to dg1|192.168.153.128|:4889… connected.
HTTP request sent, awaiting response… 404 Not Found
2012-07-25 23:43:32 ERROR 404: Not Found.

After checking the output, I saw the folder – “…/10.2.0.3.0/linux/oui…..”

I checked the folder at the Grid installation site and and as it was 64 bit installation, the folder was names “linux_x64”

$ORACLE_HOME/sysman/agent_download/10.2.0.3.0/linux_x64

I renamed the folder and run the installation command again. But I got the same error. When checking the output, I saw that it’s looking for oui_linux.jar file which is probably “linux_x64.jar” at the Grid site. I opened agentDownload.linux_x64 file which I copied from Grid site and checked for linux_x64 keyword. I changed line 362:

“Linux.x86_64”) os =linux_x64;;

to

“Linux.x86_64”) os =linux;;

And renamed oui_linux_x64.jar file to oui_linux.jar

And the installation succeeded :)

I would strongly reccomend you to install correct version of the Grid Control and Oracle Software. If you’re running 32 bit OS, then install 32 bit Software and do the same for 64 bit installation

Posted in Administration | No Comments »

ORA-00600: internal error code, arguments: [keltnfy-ldmInit]

Posted by Kamran Agayev A. on July 17th, 2012

Today I got my second internal error while starting the database.

[php]

Starting up ORACLE RDBMS Version: 10.2.0.1.0.
Errors in file /opt/oracle/10.2/admin/ORCL/udump/ORCL_ora_535.trc:
ORA-00600: internal error code, arguments: [keltnfy-ldmInit], [46], [1], [], [], [], [], []
USER: terminating instance due to error 600
Instance terminated by USER, pid = 535

[/php]

I checked all parameters at spfile, but everything seems to be ok. After checking metalink note, I find out that this is because Oracle can’t get host information.

Startup Database Produces ORA-00600: [Keltnfy-Ldminit] [ID 336447.1]

As I already changed the hostname, it wasn’t changed at /etc/hosts file. After changing /etc/hosts file and providing correct hostname, the database opened

Posted in Administration | No Comments »