Saturday, December 6, 2008

ORA-07445: exception encountered: core dump kghalp SIGSEGV ORA-10980

Problem Description
I wanted to do online redefinition on a table. Whenever I run start_redef_table procedure then, while creating materialized view it failed with ORA-03114 and ORA-03113.
Below is the scenario.

SQL> exec dbms_redefinition.start_redef_table('M', 'HISTORY', 'HISTORY_INT');

ERROR:
ORA-03114: not connected to ORACLE


BEGIN dbms_redefinition.start_redef_table('M', 'HISTORY', 'HISTORY_INT'); END;

*
ERROR at line 1:
ORA-03113: end-of-file on communication channel

In the Alert log file it displays,

Sat Dec 6 16:34:40 2008
Errors in file /var/opt/dumpfile/udump/arjudb_ora_12860.trc:
ORA-07445: exception encountered: core dump [kghalp()+58] [SIGSEGV] [Address not mapped to object] [0x000000068] [] []
ORA-10980: prevent sharing of parsed query during Materialized View query generation
Sat Dec 6 16:36:39 2008

Cause of the Problem

This is an oracle bug. When auditing is enabled and creating materialized view or executing start_redef_table and a Commit/Rollback/Abort transaction is done, memory which is being cleaned up is accessed leading to a dump.

Solution of the Problem
As this problem is an oracle bug and this bug fires when auditing is enabled so there are two solutions.
1)Disable Audit and Restart database:

SQL> alter system set audit_trail=NONE scope=spfile;

System altered.

Since audit_trail is a static parameter so it is needed to bounce the database.
SQL> shutdown immediate;
SQL> startup


2)Apply Patch 10.2.0.3:
This bug is fixed on 10.2.0.3. So apply patch set 10.2.0.3.

Related Documents

Thursday, December 4, 2008

Import fails with ORA-39005, ORA-31600: invalid input value NULL for parameter

Problem Description
I used both remap_schema(import operation will be performed in another user than the user whose data to be imported) and remap_tablespace(tablespace to be changed while importing) and the import operation failed with ORA-39005 and ORA-31600.
$host impdp directory=d dumpfile=user1_metadata04-12-08.dmp remap_schema=user1:user2 table_exists_action=skip logfile=user1_metadata04-12-08.log \
remap_tablespace=user1_SPC:user2_SPC \
remap_tablespace=user1_HISTORY_DETAIL_SPC: user2_HISTORY_DETAIL_SPC \
remap_tablespace=user1_HISTORY_SPC:user2_HISTORY_SPC \
remap_tablespace=user1_ACC_SPC:user2_SPC \
remap_tablespace=user1_HISTORY_DETAIL_INDX_SPC:user2_HIS_DETAIL_INDX_SPC \
remap_tablespace=user1_HISTORY_INDX_SPC:user2_HISTORY_INDX_SPC

Import: Release 10.2.0.1.0 - 64bit Production on Thursday, 04 December, 2008 19:17:08

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Username: system
Password:

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORA-39005: inconsistent arguments
ORA-31600: invalid input value NULL for parameter VALUE in function DBMS_DATAPUMP.METADATA_REMAP

Cause of the Problem
A NULL or invalid value was supplied for the parameter. Here a NULL value was supplied for the parameter remap_tablespace. The new_value was considered as NULL because of space after colon.

There was a space in the line user1_HISTORY_DETAIL_SPC: user2_HISTORY_DETAIL_SPC.
The space is just after colon and hence error comes.

Solution of the Problem
Ensure that parameters are not supplied as value NULL. Rewrite the above script as below will solve the problem.

impdp directory=d dumpfile=user1_metadata04-12-08.dmp remap_schema=user1:user2 table_exists_action=skip logfile=user1_metadata04-12-08.log \
remap_tablespace=user1_SPC:user2_SPC \
remap_tablespace=user1_HISTORY_DETAIL_SPC:user2_HISTORY_DETAIL_SPC \
remap_tablespace=user1_HISTORY_SPC:user2_HISTORY_SPC \
remap_tablespace=user1_ACC_SPC:user2_SPC \
remap_tablespace=user1_HISTORY_DETAIL_INDX_SPC:user2_HIS_DETAIL_INDX_SPC \
remap_tablespace=user1_HISTORY_INDX_SPC:user2_HISTORY_INDX_SPC

Sunday, November 30, 2008

Formatting SQL*Plus Reports

Sometimes you may find difficulties while displaying result on SQL*Plus like a column length displayed as a long length and thus does not result a fine output. In this post I will try to show how we can make good looking result displayed on SQL*Plus.

With COLUMN a column can be formatted. For string type data format is specified by A and then length. Like A7 means total column will span to 7 word length. For number data type the format is 99999 where number of 9s decide the length of digits of number data type.
Changing Column Headings
To change the heading of column a,b and c use commands like below. The vertical bar is used if you want to display the columns in a new line.

SQL> COLUMN A HEADING 'FIRST|COLUMN'
SQL> COLUMN C HEADING 'THIRD|COLUMN'
SQL> COLUMN B HEADING 'SECOND|COLUMN' FORMAT A7
SQL> select a,b,c from test1;


FIRST SECOND THIRD
COLUMN COLUMN COLUMN
---------- ------- ------
1 Hi Hi2

Setting the Underline Character
You see the underline character in the above output under heading is set to -. If you want to change it to = then use,

SQL> SET UNDERLINE =
SQL> /


FIRST SECOND THIRD
COLUMN COLUMN COLUMN
========== ======= ======
1 Hi Hi2

Default Display of columns
1)A NUMBER column's width equals the width of the heading or the width of the FORMAT plus one space for the sign, whichever is greater. If you do not explicitly use FORMAT, then the column's width will always be at least the value of SET NUMWIDTH.

BY default the NUMWIDTH is set to 10.

SQL> select 22/7 "This is the pi value" from dual;

This is the pi value
--------------------
3.14285714

SQL> show numwidth

numwidth 10

2)The default width of datatype columns is the width of the column in the database. The column width of a LONG, CLOB, NCLOB or XMLType defaults to the value of SET LONGCHUNKSIZE or SET LONG, whichever is the smaller.

If LONG is set to 80 and LONGCHUNKSIZE is set to 90 then for CLOB database only first 80 character will be shown on Sql*plus by default.

3)The default width and format of unformatted DATE columns in SQL*Plus is determined by the database NLS_DATE_FORMAT parameter. Otherwise, the default format width is A9.

Listing and Resetting Column Display Attributes
1)To list the current display attributes for a given column, use the COLUMN command followed by the column name.

COLUMN column_name

2)To list the current display attributes for all columns, enter just the COLUMN command.

COLUMN

3)To reset the display attributes for a column to their default values, use the CLEAR clause of the COLUMN command as below.

COLUMN column_name CLEAR

4)To reset all column display attributes to their default values enter,

CLEAR COLUMNS


Suppressing and Restoring Column Display Attributes

Though COLUMN command you once format a column and now you want to use the default display attributes for the column, but you don't want to remove the attributes you have defined through the COLUMN command. You can achieve that by,
COLUMN column_name OFF

To restore the attributes you defined through COLUMN, use the ON clause:

COLUMN column_name ON

Printing a Line of Characters after Wrapped Column Values
RECSEP determines when the line of characters is printed;
-you set RECSEP to EACH to print after every line,
-to WRAPPED to print after wrapped lines,
-The default setting of RECSEP is WRAPPED.

RECSEPCHAR sets the character printed in each line.

To print a line of dashes after each wrapped column value, enter:

SET RECSEP WRAPPED
SET RECSEPCHAR "-"


Clarifying Your Report with Spacing and Summary Lines
With the BREAK command you can suppress the duplicate values in a column specified in an ORDER BY clause. If two columns values come in the subsequent rows and you use BREAK on the column then only one will be shown as below.

Note that here I did not use order by clause. You should use order by on the column that you break. If you do not do this, breaks occur every time the column value changes.

SQL> select station_id,uname from users where station_id!=1 and rownum<=10;

STATION_ID UNAME
---------- --------------------------------------------------
4 a.sadat
14 parvez
14 reza
14 voyeger
40 support
71 accounts5
71 bill5
71 chinmoy
71 crash5
71 mubeen5

10 rows selected.

SQL> break on station_id skip 2
SQL> select station_id,uname from users where station_id!=1 and rownum<=10;


STATION_ID UNAME
---------- --------------------------------------------------
4 a.sadat


14 parvez
reza
voyeger


40 support


71 accounts5
bill5
chinmoy
crash5
mubeen5



10 rows selected.

SQL> break on station_id skip page
SQL> /


STATION_ID UNAME
---------- --------------------------------------------------
4 a.sadat

STATION_ID UNAME
---------- --------------------------------------------------
14 parvez
reza
voyeger

STATION_ID UNAME
---------- --------------------------------------------------
40 support

STATION_ID UNAME
---------- --------------------------------------------------
71 accounts5
bill5
chinmoy
crash5
mubeen5

10 rows selected.

To insert n blank lines, use the BREAK command in the following form:

BREAK ON break_column SKIP n

where n can be 1 or 2 or ....
To skip a page, use the command in this form:

BREAK ON break_column SKIP PAGE


You may wish to insert blank lines or a blank page after every row.
To skip n lines after every row, use BREAK in the following form:

BREAK ON ROW SKIP n

To skip a page after every row, use

BREAK ON ROW SKIP PAGE


You can list your current break definition by entering the BREAK command with no clauses:

BREAK


You can remove the current break definition by entering the CLEAR command with the BREAKS clause:

CLEAR BREAKS

Use of bind variables in Sql*plus

Bind variables are variables that are declared inside PL/SQL or a variable in a SQL statement that must be replaced with a valid value.

In the SQL*Plus you can also create bind variable. If you create a bind variable in SQL*Plus, you can use the variable as you would a declared variable in your PL/SQL subprogram and then access the variable from SQL*Plus.

Creating Bind Variables
In order to create bind variable in Sql*plus you have to use variable keyword. To create a bind variable named bind_var as number datatype use,
variable bind_var NUMBER

Displaying Bind Variables

To display all bind variables in the session just use variable keyword.
SQL> variable
variable bind_var
datatype NUMBER

In order to display the value of a particular bind variable use,
SQL> print bind_var
BIND_VAR
----------

Using Bind Variables
To use bind variable first use colon(:) and then give variable name. In order to change values of bind variable you must enter in a PL/SQL block. To change bind variable of bind_var to 10 use,
begin
:bind_var:=10;
end;
/

List of country calling codes in the world

Country Code
Afghanistan &0000000000093000.00000093
Albania &0000000000035500.000000355
Algeria &0000000000021300.000000213
American Samoa &0000000000016840.0000001-684
Andorra &0000000000037600.000000376
Angola &0000000000024400.000000244
Anguilla &0000000000012640.0000001-264
Antigua &0000000000012680.0000001-268
Argentina &0000000000054000.00000054
Armenia &0000000000037400.000000374
Aruba &0000000000029700.000000297
Ascension &0000000000024700.000000247
Australia &0000000000061000.00000061
Australian External Territories &0000000000067200.000000672
Austria &0000000000043000.00000043
Azerbaijan &0000000000099400.000000994
Bahamas &0000000000012420.0000001-242
Bahrain &0000000000097300.000000973
Bangladesh &0000000000088000.000000880
Barbados &0000000000012460.0000001-246
Barbuda &0000000000012680.0000001-268
Belarus &0000000000037500.000000375
Belgium &0000000000032000.00000032
Belize &0000000000050100.000000501
Benin &0000000000022900.000000229
Bermuda &0000000000014410.0000001-441
Bhutan &0000000000097500.000000975
Bolivia &0000000000059100.000000591
Bosnia and Herzegovina &0000000000038700.000000387
Botswana &0000000000026700.000000267
Brazil &0000000000055000.00000055
British Virgin Islands &0000000000012840.0000001-284
Brunei Darussalam &0000000000067300.000000673
Bulgaria &0000000000035900.000000359
Burkina Faso &0000000000022600.000000226
Burundi &0000000000025700.000000257
Cambodia &0000000000085500.000000855
Cameroon &0000000000023700.000000237
Canada &0000000000010000.0000001
Cape Verde Islands &0000000000023800.000000238
Cayman Islands &0000000000013450.0000001-345
Central African Republic &0000000000023600.000000236
Chad &0000000000023500.000000235
Chatham Island (New Zealand) &0000000000064000.00000064
Chile &0000000000056000.00000056
China (PRC) &0000000000086000.00000086
Christmas Island &0000000000061800.00000061-8
Cocos-Keeling Islands &0000000000061000.00000061
Colombia &0000000000057000.00000057
Comoros &0000000000026900.000000269
Congo &0000000000024200.000000242
Congo, Dem. Rep. of (Zaire) &0000000000024300.000000243
Cook Islands &0000000000068200.000000682
Costa Rica &0000000000050600.000000506
Côte d'Ivoire (Ivory Coast) &0000000000022500.000000225
Croatia &0000000000038500.000000385
Cuba &0000000000053000.00000053
Cuba (Guantanamo Bay) &0000000000053990.0000005399
Curaçao &0000000000059900.000000599
Cyprus &0000000000035700.000000357
Czech Republic &0000000000042000.000000420
Denmark &0000000000045000.00000045
Diego Garcia &0000000000024600.000000246
Djibouti &0000000000025300.000000253
Dominica &0000000000017670.0000001-767
Dominican Republic &0000000000018090.0000001-809 and 1-829
East Timor &0000000000067000.000000670
Easter Island &0000000000056000.00000056
Ecuador &0000000000059300.000000593
Egypt &0000000000020000.00000020
El Salvador &0000000000050300.000000503
Ellipso (Mobile Satellite service) &0000000000088120.0000008812, 8813
EMSAT (Mobile Satellite service) &0000000000088213.00000088213
Equatorial Guinea &0000000000024000.000000240
Eritrea &0000000000029100.000000291
Estonia &0000000000037200.000000372
Ethiopia &0000000000025100.000000251
Falkland Islands &0000000000050000.000000500
Faroe Islands &0000000000029800.000000298
Fiji Islands &0000000000067900.000000679
Finland &0000000000035800.000000358
France &0000000000033000.00000033
French Antilles &0000000000059600.000000596
French Guiana &0000000000059400.000000594
French Polynesia &0000000000068900.000000689
Gabonese Republic &0000000000024100.000000241
Gambia &0000000000022000.000000220
Georgia &0000000000099500.000000995
Germany &0000000000049000.00000049
Ghana &0000000000023300.000000233
Gibraltar &0000000000035000.000000350
Global Mobile Satellite System (GMSS) &0000000000088100.000000881
Globalstar (Mobile Satellite Service) &0000000000088180.0000008818, 8819
Greece &0000000000030000.00000030
Greenland &0000000000029900.000000299
Grenada &0000000000014730.0000001-473
Guadeloupe &0000000000059000.000000590
Guam &0000000000016710.0000001-671
Guantanamo Bay &0000000000053990.0000005399
Guatemala &0000000000050200.000000502
Guinea &0000000000022400.000000224
Guinea-Bissau &0000000000024500.000000245
Guyana &0000000000059200.000000592
Haiti &0000000000050900.000000509
Honduras &0000000000050400.000000504
Hong Kong &0000000000085200.000000852
Hungary &0000000000036000.00000036
Iceland &0000000000035400.000000354
ICO Global (Mobile Satellite Service) &0000000000088100.0000008810, 8811
India &0000000000091000.00000091
Indonesia &0000000000062000.00000062
Inmarsat (Atlantic Ocean - East) &0000000000087100.000000871
Inmarsat (Atlantic Ocean - West) &0000000000087400.000000874
Inmarsat (Indian Ocean) &0000000000087300.000000873
Inmarsat (Pacific Ocean) &0000000000087200.000000872
Inmarsat SNAC &0000000000087000.000000870
International Freephone Service &0000000000080000.000000800
International Shared Cost Service (ISCS) &0000000000080800.000000808
Iran &0000000000098000.00000098
Iraq &0000000000096400.000000964
Ireland &0000000000035300.000000353
Iridium (Mobile Satellite service) &0000000000088160.0000008816, 8817
Israel &0000000000097200.000000972
Italy &0000000000039000.00000039
Jamaica &0000000000018760.0000001-876
Japan &0000000000081000.00000081
Jordan &0000000000096200.000000962
Kazakhstan &0000000000076000.0000007-6, 7-7
Kenya &0000000000025400.000000254
Kiribati &0000000000068600.000000686
Korea (North) &0000000000085000.000000850
Korea (South) &0000000000082000.00000082
Kuwait &0000000000096500.000000965
Kyrgyz Republic &0000000000099600.000000996
Laos &0000000000085600.000000856
Latvia &0000000000037100.000000371
Lebanon &0000000000096100.000000961
Lesotho &0000000000026600.000000266
Liberia &0000000000023100.000000231
Libya &0000000000021800.000000218
Liechtenstein &0000000000042300.000000423
Lithuania &0000000000037000.000000370
Luxembourg &0000000000035200.000000352
Macao &0000000000085300.000000853
Macedonia (Former Yugoslav Rep of.) &0000000000038900.000000389
Madagascar &0000000000026100.000000261
Malawi &0000000000026500.000000265
Malaysia &0000000000060000.00000060
Maldives &0000000000096000.000000960
Mali Republic &0000000000022300.000000223
Malta &0000000000035600.000000356
Marshall Islands &0000000000069200.000000692
Martinique &0000000000059600.000000596
Mauritania &0000000000022200.000000222
Mauritius &0000000000023000.000000230
Mayotte Island &0000000000026200.000000262
Mexico &0000000000052000.00000052
Micronesia, (Federal States of) &0000000000069100.000000691
Midway Island &0000000000018080.0000001-808
Moldova &0000000000037300.000000373
Monaco &0000000000037700.000000377
Mongolia &0000000000097600.000000976
Montenegro &0000000000038200.000000382
Montserrat &0000000000016640.0000001-664
Morocco &0000000000021200.000000212
Mozambique &0000000000025800.000000258
Myanmar &0000000000095000.00000095
Namibia &0000000000026400.000000264
Nauru &0000000000067400.000000674
Nepal &0000000000097700.000000977
Netherlands &0000000000031000.00000031
Netherlands Antilles &0000000000059900.000000599
Nevis &0000000000018690.0000001-869
New Caledonia &0000000000068700.000000687
New Zealand &0000000000064000.00000064
Nicaragua &0000000000050500.000000505
Niger &0000000000022700.000000227
Nigeria &0000000000023400.000000234
Niue &0000000000068300.000000683
Norfolk Island &0000000000067200.000000672
Northern Marianas Islands (Saipan, Rota, and Tinian) &0000000000016700.0000001-670
Norway &0000000000047000.00000047
Oman &0000000000096800.000000968
Pakistan &0000000000092000.00000092
Palau &0000000000068000.000000680
Palestinian Settlements &0000000000097000.000000970
Panama &0000000000050700.000000507
Papua New Guinea &0000000000067500.000000675
Paraguay &0000000000059500.000000595
Peru &0000000000051000.00000051
Philippines &0000000000063000.00000063
Poland &0000000000048000.00000048
Portugal &0000000000035100.000000351
Puerto Rico &0000000000017870.0000001-787 or 1-939
Qatar &0000000000097400.000000974
Réunion Island &0000000000026200.000000262
Romania &0000000000040000.00000040
Russia &0000000000070000.0000007
Rwandese Republic &0000000000025000.000000250
St. Helena &0000000000029000.000000290
St. Kitts/Nevis &0000000000018690.0000001-869
St. Lucia &0000000000017580.0000001-758
St. Pierre and Miquelon &0000000000050800.000000508
St. Vincent and Grenadines &0000000000017840.0000001-784
Samoa &0000000000068500.000000685
San Marino &0000000000037800.000000378
São Tomé and Principe &0000000000023900.000000239
Saudi Arabia &0000000000096600.000000966
Senegal &0000000000022100.000000221
Serbia &0000000000038100.000000381
Seychelles Republic &0000000000024800.000000248
Sierra Leone &0000000000023200.000000232
Singapore &0000000000065000.00000065
Slovak Republic &0000000000042100.000000421
Slovenia &0000000000038600.000000386
Solomon Islands &0000000000067700.000000677
Somali Democratic Republic &0000000000025200.000000252
South Africa &0000000000027000.00000027
Spain &0000000000034000.00000034
Sri Lanka &0000000000094000.00000094
Sudan &0000000000024900.000000249
Suriname &0000000000059700.000000597
Swaziland &0000000000026800.000000268
Sweden &0000000000046000.00000046
Switzerland &0000000000041000.00000041
Syria &0000000000096300.000000963
Taiwan &0000000000088600.000000886
Tajikistan &0000000000099200.000000992
Tanzania &0000000000025500.000000255
Thailand &0000000000066000.00000066
Thuraya (Mobile Satellite service) &0000000000088216.00000088216
Timor Leste &0000000000067000.000000670
Togolese Republic &0000000000022800.000000228
Tokelau &0000000000069000.000000690
Tonga Islands &0000000000067600.000000676
Trinidad and Tobago &0000000000018680.0000001-868
Tunisia &0000000000021600.000000216
Turkey &0000000000090000.00000090
Turkmenistan &0000000000099300.000000993
Turks and Caicos Islands &0000000000016490.0000001-649
Tuvalu &0000000000068800.000000688
Uganda &0000000000025600.000000256
Ukraine &0000000000038000.000000380
United Arab Emirates &0000000000097100.000000971
United Kingdom &0000000000044000.00000044
United States of America &0000000000010000.0000001
Universal Personal Telecommunications (UPT) &0000000000087800.000000878
Uruguay &0000000000059800.000000598
US Virgin Islands &0000000000013400.0000001-340
Uzbekistan &0000000000099800.000000998
Vanuatu &0000000000067800.000000678
Vatican City &0000000000039066.00000039-06-698; 379
Venezuela &0000000000058000.00000058
Vietnam &0000000000084000.00000084
Wake Island &0000000000080800.000000808
Wallis and Futuna Islands &0000000000068100.000000681
Yemen &0000000000096700.000000967
Zambia &0000000000026000.000000260
Zanzibar &0000000000025500.000000255
Zimbabwe &0000000000026300.000000263