Sunday, May 24, 2009

ORA-27100: shared memory realm already exists

While you connect to database, if ORA-27100 is signalled with ORA-01034 then have a look at the post http://arjudba.blogspot.com/2008/04/ora-01034-ora-27101-shared-memory-realm.html

However if you merely see ORA-27100 error upon startup then proceed with this post.

Problem Description
When you try to startup your database instance even you issue startup nomount ORA-27100 is reported.

SQL> startup nomount
ORA-27100: shared memory realm already exists

Similarly, if you try to shutdown your oracle instance then ORA-27100 is reported.

SQL> shutdown immediate
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist

Restarting the service also does not help any. And even in some cases, rebooting the server does not help as well.

Current Changes in the Server
We had sga_max_size to 600M and then we change it to 1G. After that whenever we restart oracle database above message rises.

Cause of the Problem
Some changes are made in sga_max_size or sga parameters. After that database is abnormally shut down whenever you issue startup, ORA-27100 is received as a result of changes made to parameters affecting the SGA size.

Solution of the Problem
In most cases, ORA-27100 can be resolved by simply restarting Windows. However if avaialibility is too important and you can't afford the time of starting windows then,
- Move/ Rename database spfile so that next time starting database service can invoke old pfile to startup.

- Start the database service. Make sure pfile exist with old sga parameter settings.

- Now the service will start the database using pfile , with old SGA settings.
and you have started your database successfully.

- Create a new spfile from pfile.

Related Documents
http://arjudba.blogspot.com/2008/05/startup-fails-with-oracle-error-ora.html
http://arjudba.blogspot.com/2008/09/database-startup-fails-with-ora-27302.html
http://arjudba.blogspot.com/2008/07/database-startup-fails-with-error-ora.html
http://arjudba.blogspot.com/2008/08/startup-fails-with-ora-01261-parameter.html

http://arjudba.blogspot.com/2008/09/database-startup-fails-with-ora-00444.html

http://arjudba.blogspot.com/2008/05/database-startup-fails-with-errors-ora.html

Saturday, May 16, 2009

Drop user in mysql

In order to drop user in mysql a user issuing drop command must have one of the following two privileges.
-You have the global CREATE USER privilege.
-The DELETE privilege for the mysql database.

1)Before issuing dropping command be sure the user invokes drop command has the privileges by,
mysql> show grants;
+-----------------------------------------------------------------------------------------------------------------------
-----------------+
| Grants for root@localhost
|
+-----------------------------------------------------------------------------------------------------------------------
-----------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29' WITH GRANT OPTION |
+-----------------------------------------------------------------------------------------------------------------------
-----------------+
1 row in set (0.00 sec)

2)
Note that, you might be concerned about REVOKE privilege of the user that you are going to drop specially if your mysql database is before 5.0.2. Before mysql 5.0.2, the granted privileges are not automatically revoked and you must revoke them yourself.

Suppose we want to DROP a user named arju2 in mysql before 5.0.2. Then before dropping arju2 user check the privilege by,
mysql> show grants for arju2@localhost;
+-----------------------------------------------------------------------------------------------------------------------
+
| Grants for arju2@localhost
|
+-----------------------------------------------------------------------------------------------------------------------
+
| GRANT ALL PRIVILEGES ON *.* TO 'arju2'@'localhost' IDENTIFIED BY PASSWORD '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29'
|
+-----------------------------------------------------------------------------------------------------------------------
+
1 row in set (0.00 sec)

Revoke privileges by,
mysql> REVOKE ALL PRIVILEGES ON *.* FROM arju2@localhost;
Query OK, 0 rows affected (0.00 sec)

Check again,
mysql> show grants for arju2@localhost;
+--------------------------------------------------------------------------------------------------------------+
| Grants for arju2@localhost |
+--------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'arju2'@'localhost' IDENTIFIED BY PASSWORD '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29' |
+--------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)


However if your mysql database version is 5.0.2 onwards then the granted privileges are automatically revoked.

3) Now drop the user.
Note that dropping user by simply drop user username statement will be failed if user's host is assigned to localhost. If you specify only the user name part of the account name, a host name part of '%' is used.

So following statement will be failed as it interpreted as 'arju2'@'%'.
mysql> drop user arju2;
ERROR 1396 (HY000): Operation DROP USER failed for 'arju2'@'%'

Check the host of the user querying from,
mysql> select user, host from user;
+---------+-----------+
| user | host |
+---------+-----------+
| magento | % |
| root | 127.0.0.1 |
| | localhost |
| arju2 | localhost |
| magento | localhost |
| momin | localhost |
| pma | localhost |
| richard | localhost |
| rober4t | localhost |
| robert | localhost |
| root | localhost |
+---------+-----------+
11 rows in set (0.00 sec)

Then drop it by,
mysql> drop user 'arju2'@'localhost';
Query OK, 0 rows affected (0.00 sec)

Note that if user host is defined as '%' then no need to add host name while dropping user. Below is an example.
mysql> create user test;
Query OK, 0 rows affected (0.00 sec)
mysql> select user, host from user where user='test';
+------+------+
| user | host |
+------+------+
| test | % |
+------+------+
1 row in set (0.00 sec)

mysql> drop user test;
Query OK, 0 rows affected (0.00 sec)

mysql> select user, host from user where user='test';
Empty set (0.00 sec)

Related Documents
http://arjudba.blogspot.com/2009/05/creating-and-using-database-in-mysql.html
http://arjudba.blogspot.com/2009/05/issuing-mysql-commands.html
http://arjudba.blogspot.com/2009/05/connecting-to-and-disconnecting-from.html

Friday, May 15, 2009

Create user in mysql

The mysql user information is kept inside USER table under mysql database. So creation of new user will affect the USER table of mysql database. In order to know a list of mysql users according with user table's description issue,

Here test is the root account password.

D:\xampp\mysql\bin>mysql -u root -ptest
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.30-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Database changed
mysql> desc user;
+-----------------------+-----------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+-----------------------------------+------+-----+---------+-------+
| Host | char(60) | NO | PRI | | |
| User | char(16) | NO | PRI | | |
| Password | char(41) | NO | | | |
| Select_priv | enum('N','Y') | NO | | N | |
| Insert_priv | enum('N','Y') | NO | | N | |
| Update_priv | enum('N','Y') | NO | | N | |
| Delete_priv | enum('N','Y') | NO | | N | |
| Create_priv | enum('N','Y') | NO | | N | |
| Drop_priv | enum('N','Y') | NO | | N | |
| Reload_priv | enum('N','Y') | NO | | N | |
| Shutdown_priv | enum('N','Y') | NO | | N | |
| Process_priv | enum('N','Y') | NO | | N | |
| File_priv | enum('N','Y') | NO | | N | |
| Grant_priv | enum('N','Y') | NO | | N | |
| References_priv | enum('N','Y') | NO | | N | |
| Index_priv | enum('N','Y') | NO | | N | |
| Alter_priv | enum('N','Y') | NO | | N | |
| Show_db_priv | enum('N','Y') | NO | | N | |
| Super_priv | enum('N','Y') | NO | | N | |
| Create_tmp_table_priv | enum('N','Y') | NO | | N | |
| Lock_tables_priv | enum('N','Y') | NO | | N | |
| Execute_priv | enum('N','Y') | NO | | N | |
| Repl_slave_priv | enum('N','Y') | NO | | N | |
| Repl_client_priv | enum('N','Y') | NO | | N | |
| Create_view_priv | enum('N','Y') | NO | | N | |
| Show_view_priv | enum('N','Y') | NO | | N | |
| Create_routine_priv | enum('N','Y') | NO | | N | |
| Alter_routine_priv | enum('N','Y') | NO | | N | |
| Create_user_priv | enum('N','Y') | NO | | N | |
| Event_priv | enum('N','Y') | NO | | N | |
| Trigger_priv | enum('N','Y') | NO | | N | |
| ssl_type | enum('','ANY','X509','SPECIFIED') | NO | | | |
| ssl_cipher | blob | NO | | NULL | |
| x509_issuer | blob | NO | | NULL | |
| x509_subject | blob | NO | | NULL | |
| max_questions | int(11) unsigned | NO | | 0 | |
| max_updates | int(11) unsigned | NO | | 0 | |
| max_connections | int(11) unsigned | NO | | 0 | |
| max_user_connections | int(11) unsigned | NO | | 0 | |
+-----------------------+-----------------------------------+------+-----+---------+-------+
39 rows in set (0.14 sec)

mysql> select host, user from user;
+-----------+---------+
| host | user |
+-----------+---------+
| % | magento |
| 127.0.0.1 | root |
| localhost | |
| localhost | magento |
| localhost | pma |
| localhost | root |
+-----------+---------+
6 rows in set (0.00 sec)

By query the Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv etc you can check whether user has certain types of privilege or not.

There are several ways to create user in mysql which is described below.

Way 01: With the CREATE USER statement
1)Connect to mysql database as a user who must have the global CREATE USER privilege or the INSERT privilege for the mysql database. You can use root because by default root has privilege to create user.

2)In fact CREATE USER statement creates a new record in the mysql.user table that has no privileges assigned by default.

mysql> create user arju;
Query OK, 0 rows affected (0.13 sec)
mysql> select  user,password, host, select_priv, insert_priv from mysql.user where user='arju';
+------+----------+------+-------------+-------------+
| user | password | host | select_priv | insert_priv |
+------+----------+------+-------------+-------------+
| arju | | % | N | N |
+------+----------+------+-------------+-------------+
1 row in set (0.00 sec)

Notice that if you specify only the user name part of the account name while creating user, a host name part of '%' is used.

User arju is not assigned any password in this way as you see password is null. To assign password to user arju issue,

mysql> set password for 'arju'=password('test');
Query OK, 0 rows affected (0.03 sec)
mysql> select  user,password, host, select_priv, insert_priv from mysql.user where user='arju';
+------+-------------------------------------------+------+-------------+-------------+
| user | password | host | select_priv | insert_priv |
+------+-------------------------------------------+------+-------------+-------------+
| arju | *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 | % | N | N |
+------+-------------------------------------------+------+-------------+-------------+
1 row in set (0.00 sec)

In one command you can set password while creating user. The following command will crate a user arju2 and password is test in the host localhost. Both password, username and hostname should be within single quote.

mysql> create user 'arju2'@'localhost' identified by 'test';
Query OK, 0 rows affected (0.00 sec)
mysql> select  user,password, host, select_priv, insert_priv from mysql.user where user='arju2';
+-------+-------------------------------------------+-----------+-------------+-------------+
| user | password | host | select_priv | insert_priv |
+-------+-------------------------------------------+-----------+-------------+-------------+
| arju2 | *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 | localhost | N | N |
+-------+-------------------------------------------+-----------+-------------+-------------+
1 row in set (0.00 sec)

If you don't put username, host name and password within single quote syntax error will be resulted.

mysql> create user 'arju2'@'localhost' identified by test;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'test' at line 1

An equivalent statement of setting password is issuing update statement.

mysql> UPDATE mysql.user SET Password=PASSWORD('test')
-> WHERE User='arju' AND Host='%';

Query OK, 0 rows affected (0.05 sec)
Rows matched: 1 Changed: 0 Warnings: 0

Changing via update and insert of the user table, it is necessary to use FLUSH PRIVILEGES to tell the server to reload the grant tables. Otherwise, the changes go unnoticed until you restart the server.

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.08 sec)
mysql> select  user,password, host, select_priv, insert_priv from mysql.user where user='arju';
+------+-------------------------------------------+------+-------------+-------------+
| user | password | host | select_priv | insert_priv |
+------+-------------------------------------------+------+-------------+-------------+
| arju | *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 | % | N | N |
+------+-------------------------------------------+------+-------------+-------------+
1 row in set (0.00 sec)

Now, have a look that connecting to mysql database as user arju will fail but arju2 will be successful.
D:\xampp\mysql\bin>mysql -u arju -ptest
ERROR 1045 (28000): Access denied for user 'arju'@'localhost' (using password: YES)

D:\xampp\mysql\bin>mysql -u arju2 -ptest
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.1.30-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> select user();
+-----------------+
| user() |
+-----------------+
| arju2@localhost |
+-----------------+
1 row in set (0.00 sec)

Note that the 'arju'@'localhost' account can be used only when connecting from the local host. The 'arju'@'%' account uses the '%' wildcard for the host part, so it can be used to connect from any host.

You can check the privilege assigned for a user by issuing,
mysql> show grants for arju;
+-----------------------------------------------------------------------------------------------------+
| Grants for arju@% |
+-----------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'arju'@'%' IDENTIFIED BY PASSWORD '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29' |
+-----------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show grants for arju2;
ERROR 1141 (42000): There is no such grant defined for user 'arju2' on host '%'
mysql> show grants for arju2@localhost;
+--------------------------------------------------------------------------------------------------------------+
| Grants for arju2@localhost |
+--------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'arju2'@'localhost' IDENTIFIED BY PASSWORD '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29' |
+--------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

By default it is search for host '%'.

Way 02: With the grant option
To create a user named momin with password test2 and all privileges for a particular database called ecommerce issue,
mysql> grant ALL PRIVILEGES on ecommerce.* to 'momin'@'localhost' identified by 'test2';
Query OK, 0 rows affected (0.00 sec)

mysql> use mysql;
Database changed
mysql> select host, user from user where user='momin';
+-----------+-------+
| host | user |
+-----------+-------+
| localhost | momin |
+-----------+-------+
1 row in set (0.00 sec)

D:\xampp\mysql\bin>mysql -u momin -ptest2
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 32
Server version: 5.1.30-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ecommerce |
| test |
+--------------------+
3 rows in set (0.00 sec)

Here ecommerce database is shown as we have given permission.

Way 03: Using INSERT statement into Table mysql.user
You can also create user in mysql by simply INSERT a new row into mysql.user table. Note that creating user through INSERT statement needs to use FLUSH PRIVILEGES to tell the server to reload the grant tables. If we don't do that the changes go unnoticed until you restart the server. This restriction is not applicable in CREATE USER statement.
Insert statement can be issued in two ways. One way to create user robert,

mysql> use mysql;
Database changed

mysql> INSERT INTO user SET Host='localhost',User='robert', Password=password('test');
Query OK, 1 row affected, 3 warnings (0.00 sec)

Alternative way of creating user richard is,

mysql> INSERT INTO user (Host,User,Password)
-> VALUES('localhost','richard',password('test'));

Query OK, 1 row affected, 3 warnings (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

Check by,
mysql> select user, host, password from user where user in('robert','richard');
+---------+-----------+-------------------------------------------+
| user | host | password |
+---------+-----------+-------------------------------------------+
| robert | localhost | *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 |
| richard | localhost | *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 |
+---------+-----------+-------------------------------------------+
2 rows in set (0.01 sec)

See that while setting password we used the PASSWORD() function with INSERT in order to encrypt the password. But with the CREATE USER statement it was unnecessary as create user statement automatically encrypts the password.

Related Documents
http://arjudba.blogspot.com/2009/05/creating-and-using-database-in-mysql.html
http://arjudba.blogspot.com/2009/05/issuing-mysql-commands.html
http://arjudba.blogspot.com/2009/05/connecting-to-and-disconnecting-from.html

Monday, May 11, 2009

Creating and using database in mysql

In order to know a list of mysql database in the system issue following command where we are connecting as administrative root user with password test and into host localhost. Here we are working on console, not into mysql prompt.
D:\xampp\mysql\bin>mysql -h localhost -u root -ptest  -e "show databases"
+--------------------+
| Database |
+--------------------+
| information_schema |
| arju |
| email_master_list |
| magento |
| mysql |
| phpmyadmin |
| test |
| webauth |
+--------------------+

We could do the same job into mysql prompt as,
D:\xampp\mysql\bin>mysql -h localhost -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.30-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| arju |
| email_master_list |
| magento |
| mysql |
| phpmyadmin |
| test |
| webauth |
+--------------------+
8 rows in set (0.02 sec)

Note that you must login as administrative privilege to see all databases. If you don't do that you may be see all the databases. Like below.

D:\xampp\mysql\bin>mysql -h localhost -sN -e "show databases;"
information_schema
test

Only two databases are shown here.

Now let's try to create a new database named test2. Only administrative privileged user can create the database. So if you don't login as administrative user and issuing create database command the following error will happen.

D:\xampp\mysql\bin>mysql -h localhost -e "create database test2;"
ERROR 1044 (42000) at line 1: Access denied for user ''@'localhost' to database 'test2'

From console try to create database test2 by,
D:\xampp\mysql\bin>mysql -h localhost -u root -ptest -e "create database test2;"

Notice that with password should be specified as -pPassword, i.e adjacent with -p. There is no space between and p and password.

Now check the existing database by,
D:\xampp\mysql\bin>mysql -h localhost  -u root -ptest -e "show databases;"
+--------------------+
| Database |
+--------------------+
| information_schema |
| arju |
| email_master_list |
| magento |
| mysql |
| phpmyadmin |
| test |
| test2 |
| webauth |
+--------------------+

In the mysql prompt you can create mysql database by,
D:\xampp\mysql\bin>mysql -h localhost  -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.1.30-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database test3;
Query OK, 1 row affected (0.02 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| arju |
| email_master_list |
| magento |
| mysql |
| phpmyadmin |
| test |
| test2 |
| test3 |
| webauth |
+--------------------+
10 rows in set (0.00 sec)

In order to connect to a database issue connect database_name or use database_name statement. Ensure the database name by command select database() as shown below.
mysql> connect test3;
Connection id: 17
Current database: test3

mysql> select database();
+------------+
| database() |
+------------+
| test3 |
+------------+
1 row in set (0.00 sec)

mysql> use test2;
Database changed

mysql> select database();
+------------+
| database() |
+------------+
| test2 |
+------------+
1 row in set (0.00 sec)

Related Documents
http://arjudba.blogspot.com/2009/05/issuing-mysql-commands.html
http://arjudba.blogspot.com/2009/05/connecting-to-and-disconnecting-from.html

Sunday, May 10, 2009

Issuing MySQL commands

After connecting to mysql as it is described in http://arjudba.blogspot.com/2009/05/connecting-to-and-disconnecting-from.html you can issue mysql commands within mysql> prompt.

Below is a simple example which will print mysql version number.

D:\xampp\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.30-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> select version();
+------------------+
| version() |
+------------------+
| 5.1.30-community |
+------------------+
1 row in set (0.06 sec)

From the query and query about let's discuss about some default characters of issuing mysql commands and it's output.

1)MySQL commands end with semicolon. An exception is quit command.

2)After command is executed in server mysql shows mysql> prompt in order to indicate that it is suitable to take another input.

3)mysql displays query output in tabular form (rows and columns) by default.

4)After query is executed, it displays number of rows returned by the query as well as clock time needed for the query.

Let's now see another example.
mysql> select version()
-> ,
-> 'USER()
'> '
-> ,
-> "NOW()
"> "
-> ;

+------------------+---------+--------+
| version() | USER()
| NOW()
|
+------------------+---------+--------+
| 5.1.30-community | USER()
| NOW()
|
+------------------+---------+--------+
1 row in set (0.00 sec)
mysql>

It displays version number information and then displays two strings 'USER()' and "NOW()". But look at the mysql prompt. It changes from -> to '>, -> to "> , -> to mysql> etc. That prompt indicates that it is waiting for a letters(s) that mysql expects.

Following is the list of mysql prompts with their meaning.

1)mysql> : Mysql is ready to accept commands.

2)-> : Mysql waits for next line of multiple-line command.

3)'> : Waiting for next line plus waiting for completion of a string that began with a single quote (').

4)"> : Waiting for next line plus waiting for completion of a string that began with a double quote (").

5)`> : Waiting for next line plus waiting for completion of an identifier that began with a backtick (`).

6)/*> : Waiting for next line plus waiting for completion of a comment that began with /*.

Related Documents
http://arjudba.blogspot.com/2009/05/connecting-to-and-disconnecting-from.html

Connecting to and disconnecting from MySQL

With the MySQL server installed and MySQL server daemon (Unix) or MySQL service (Windows) running you can connect to mysql database.

In order to know a list of mysql commands on your console, go to mysql installation directory and then into bin folder. Writing mysql --help you provide of a list of commands which you can use with mysql command. Output is shown below.

D:\xampp\mysql\bin>mysql --help
mysql  Ver 14.14 Distrib 5.1.30, for Win32 (ia32)
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Usage: mysql [OPTIONS] [database]
-?, --help Display this help and exit.
-I, --help Synonym for -?
--auto-rehash Enable automatic rehashing. One doesn't need to use
'rehash' to get table and field completion, but startup
and reconnecting may take a longer time. Disable with
--disable-auto-rehash.
-A, --no-auto-rehash
No automatic rehashing. One has to use 'rehash' to get
table and field completion. This gives a quicker start of
mysql and disables rehashing on reconnect. WARNING:
options deprecated; use --disable-auto-rehash instead.
-B, --batch Don't use history file. Disable interactive behavior.
(Enables --silent)
--character-sets-dir=name
Directory where character sets are.
--column-type-info Display column type information.
-c, --comments Preserve comments. Send comments to the server. The
default is --skip-comments (discard comments), enable
with --comments
-C, --compress Use compression in server/client protocol.
-#, --debug[=#] This is a non-debug version. Catch this and exit
--debug-check Check memory and open file usage at exit .
-T, --debug-info Print some debug info at exit.
-D, --database=name Database to use.
--default-character-set=name
Set the default character set.
--delimiter=name Delimiter to be used.
-e, --execute=name Execute command and quit. (Disables --force and history
file)
-E, --vertical Print the output of a query (rows) vertically.
-f, --force Continue even if we get an sql error.
-G, --named-commands
Enable named commands. Named commands mean this program's
internal commands; see mysql> help . When enabled, the
named commands can be used from any line of the query,
otherwise only from the first line, before an enter.
Disable with --disable-named-commands. This option is
disabled by default.
-g, --no-named-commands
Named commands are disabled. Use \* form only, or use
named commands only in the beginning of a line ending
with a semicolon (;) Since version 10.9 the client now
starts with this option ENABLED by default! Disable with
'-G'. Long format commands still work from the first
line. WARNING: option deprecated; use
--disable-named-commands instead.
-i, --ignore-spaces Ignore space after function names.
--local-infile Enable/disable LOAD DATA LOCAL INFILE.
-b, --no-beep Turn off beep on error.
-h, --host=name Connect to host.
-H, --html Produce HTML output.
-X, --xml Produce XML output
--line-numbers Write line numbers for errors.
-L, --skip-line-numbers
Don't write line number for errors. WARNING: -L is
deprecated, use long version of this option instead.
-n, --unbuffered Flush buffer after each query.
--column-names Write column names in results.
-N, --skip-column-names
Don't write column names in results. WARNING: -N is
deprecated, use long version of this options instead.
-O, --set-variable=name
Change the value of a variable. Please note that this
option is deprecated; you can set variables directly with
--variable-name=value.
--sigint-ignore Ignore SIGINT (CTRL-C)
-o, --one-database Only update the default database. This is useful for
skipping updates to other database in the update log.
-p, --password[=name]
Password to use when connecting to server. If password is
not given it's asked from the tty.
-W, --pipe Use named pipes to connect to server.
-P, --port=# Port number to use for connection or 0 for default to, in
order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/services, built-in default (3306).
--prompt=name Set the mysql prompt to this value.
--protocol=name The protocol of connection (tcp,socket,pipe,memory).
-q, --quick Don't cache result, print it row by row. This may slow
down the server if the output is suspended. Doesn't use
history file.
-r, --raw Write fields without conversion. Used with --batch.
--reconnect Reconnect if the connection is lost. Disable with
--disable-reconnect. This option is enabled by default.
-s, --silent Be more silent. Print results with a tab as separator,
each row on new line.
--shared-memory-base-name=name
Base name of shared memory.
-S, --socket=name Socket file to use for connection.
--ssl Enable SSL for connection (automatically enabled with
other flags). Disable with --skip-ssl.
--ssl-ca=name CA file in PEM format (check OpenSSL docs, implies
--ssl).
--ssl-capath=name CA directory (check OpenSSL docs, implies --ssl).
--ssl-cert=name X509 cert in PEM format (implies --ssl).
--ssl-cipher=name SSL cipher to use (implies --ssl).
--ssl-key=name X509 key in PEM format (implies --ssl).
--ssl-verify-server-cert
Verify server's "Common Name" in its cert against
hostname used when connecting. This option is disabled by
default.
-t, --table Output in table format.
--tee=name Append everything into outfile. See interactive help (\h)
also. Does not work in batch mode. Disable with
--disable-tee. This option is disabled by default.
--no-tee Disable outfile. See interactive help (\h) also. WARNING:
option deprecated; use --disable-tee instead
-u, --user=name User for login if not current user.
-U, --safe-updates Only allow UPDATE and DELETE that uses keys.
-U, --i-am-a-dummy Synonym for option --safe-updates, -U.
-v, --verbose Write more. (-v -v -v gives the table output format).
-V, --version Output version information and exit.
-w, --wait Wait and retry if connection is down.
--connect_timeout=# Number of seconds before connection timeout.
--max_allowed_packet=#
Max packet length to send to, or receive from server
--net_buffer_length=#
Buffer for TCP/IP and socket communication
--select_limit=# Automatic limit for SELECT when using --safe-updates
--max_join_size=# Automatic limit for rows in a join when using
--safe-updates
--secure-auth Refuse client connecting to server if it uses old
(pre-4.1.1) protocol
--server-arg=name Send embedded server this as a parameter.
--show-warnings Show warnings after every statement.

Default options are read from the following files in the given order:
E:\WINDOWS\my.ini E:\WINDOWS\my.cnf C:\my.ini C:\my.cnf D:\xampp\mysql\my.ini D:\xampp\mysql\my.cnf
The following groups are read: mysql client
The following options may be given as the first argument:
--print-defaults Print the program argument list and exit
--no-defaults Don't read default options from any options file
--defaults-file=# Only read default options from the given file #
--defaults-extra-file=# Read this file after the global files are read

Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
--------------------------------- -----------------------------
auto-rehash TRUE
character-sets-dir (No default value)
column-type-info FALSE
comments FALSE
compress FALSE
debug-check FALSE
debug-info FALSE
database (No default value)
default-character-set latin1
delimiter ;
vertical FALSE
force FALSE
named-commands FALSE
local-infile FALSE
no-beep FALSE
host (No default value)
html FALSE
xml FALSE
line-numbers TRUE
unbuffered FALSE
column-names TRUE
sigint-ignore FALSE
port 0
prompt mysql>
quick FALSE
raw FALSE
reconnect TRUE
shared-memory-base-name (No default value)
socket (No default value)
ssl FALSE
ssl-ca (No default value)
ssl-capath (No default value)
ssl-cert (No default value)
ssl-cipher (No default value)
ssl-key (No default value)
ssl-verify-server-cert FALSE
table FALSE
user (No default value)
safe-updates FALSE
i-am-a-dummy FALSE
connect_timeout 0
max_allowed_packet 16777216
net_buffer_length 16384
select_limit 1000
max_join_size 1000000
secure-auth FALSE
show-warnings FALSE

Note that if the MySQL server daemon (Unix) or service (Windows) is not running, then you would get the error below.

# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

If daemon or service is running then to connect into mysql database into host localhost as user root issue,
D:\xampp\mysql\bin>mysql -h localhost -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.30-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

If you see mysql> prompt as above you are connected to mysql database. And now you can query as you wish. Note that also from shell prompt or console you can query from mysql database.

For example to know the list of mysql database issue,
D:\xampp\mysql\bin>mysql -h localhost -u root -ptest -e "show databases;"
+--------------------+
| Database |
+--------------------+
| information_schema |
| arju |
| email_master_list |
| magento |
| mysql |
| phpmyadmin |
| test |
| webauth |
+--------------------+

Sometimes you can want to remove the column heading. Then use as,

D:\xampp\mysql\bin>mysql -h localhost -u root -ptest -sN -e "show databases;"
information_schema
arju
email_master_list
magento
mysql
phpmyadmin
test
webauth

In order to disconnect from mysql prompt issue exit. Bye will be printed on the screen and it will go to console prompt.
mysql> exit
Bye

D:\xampp\mysql\bin>

On windows you can also exit by pressing CTRL+C in mysql prompt.
On unix press CTRL+D .

Thursday, May 7, 2009

How to cleanup orphaned datapump jobs from DBA_DATAPUMP_JOBS

In many cases you sometimes stop data pump job or in case of an abnormal end of the Data Pump job (the orphaned job) or using undocumented parameter KEEP_MASTER=Y, the master table remain in the database.

Though this topic is related to cleanup orphaned datapump jobs. But it is good to know several things before doing cleanup jobs.

1) You can check the orphaned data pump from the state column of the view dba_datapump_jobs and DBA_DATAPUMP_JOBS is based on gv$datapump_job, obj$, com$, and user$. Orphaned Data Pump jobs do not have an impact on new Data Pump jobs. If a new Data Pump job is started, a new entry will be created, which has no relation to the old Data Pump jobs.

2) For a new data pump job without any job name it is used a system generated name. From the dba_datapump_jobs it is checked for existing data pump jobs and then obtain a unique new system generated jobname.

3) Data pump jobs are different from DBMS_JOBS and they are maintained differently. Jobs created with DBMS_JOBS use there own processes. Data Pump jobs use a master process and worker process(es).

4) If you drop the master table while doing the data pump export or data pump import operation then the scenario is discussed below.

In case of export if you drop data pump export operation then export process will abort.

In case of import if you drop data pump import operation then import process will abort while it leads an incomplete import.

If the data pump job is completed and master table exist (a common if you do export operation with KEEP_MASTER=y) then it is safe to drop the master table.

Step by step cleanup orphaned datapump jobs is discussed below.

Step 01: Check the orphaned datapump jobs.

sqlplus / as sysdba
SET lines 140
COL owner_name FORMAT a10;
COL job_name FORMAT a20
COL state FORMAT a12
COL operation LIKE owner_name
COL job_mode LIKE owner_name
SELECT owner_name, job_name, operation, job_mode,
state, attached_sessions
FROM dba_datapump_jobs;

OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE ATTACHED_SESSIONS
---------- -------------------- ---------- ---------- ------------ -----------------
ARJU SYS_EXPORT_SCHEMA_01 EXPORT SCHEMA NOT RUNNING 0
ARJU SYS_EXPORT_SCHEMA_02 EXPORT SCHEMA NOT RUNNING 0

Step 02: Check the state field. For orphaned jobs the state will be NOT RUNNING. So from the output we can say both are orphaned jobs.

Step 03: Drop the master table.
DROP TABLE ARJU.SYS_EXPORT_SCHEMA_01;
DROP TABLE ARJU.SYS_EXPORT_SCHEMA_02;

Step 04: Check for existing data pump jobs by query issued in step 01. If objects are in recyclebin bin then purge the objects from the recyclebin.

SQL> SELECT owner_name, job_name, operation, job_mode,
state, attached_sessions
FROM dba_datapump_jobs;

OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE ATTACHED_SESSIONS
---------- -------------------- ---------- ---------- ------------ -----------------
ARJU BIN$xMNQdACzQ6yl22kj EXPORT SCHEMA NOT RUNNING 0
9U0B8A==$0
ARJU BIN$BmUy4r5MSX+ojxFk EXPORT SCHEMA NOT RUNNING 0
sw8ocg==$0

SQL> PURGE TABLE ARJU.SYS_EXPORT_SCHEMA_01;

Table purged.

SQL> PURGE TABLE ARJU.SYS_EXPORT_SCHEMA_02;

Table purged.

Check if there is any orphaned jobs again.
SQL> SELECT owner_name, job_name, operation, job_mode,
state, attached_sessions
FROM dba_datapump_jobs;

no rows selected

Step 05: In this stage you did not get any orphaned jobs if the jobs have a master table. If there are still jobs listed in dba_datapump_jobs do cleanup process like below.

SET serveroutput on
SET lines 100
DECLARE
job1 NUMBER;
BEGIN
job1 := DBMS_DATAPUMP.ATTACH('SYS_EXPORT_SCHEMA_01','ARJU');
DBMS_DATAPUMP.STOP_JOB (job1);
END;
/

DECLARE
job2 NUMBER;
BEGIN
job2 := DBMS_DATAPUMP.ATTACH('SYS_EXPORT_SCHEMA_02','ARJU');
DBMS_DATAPUMP.STOP_JOB (job2);
END;
/

Related Documents

Wednesday, May 6, 2009

Understand the Estimate parameter in data pump export

With the ESTIMATE_ONLY parameter as in discussed on http://arjudba.blogspot.com/2009/02/estimate-dumpfile-size-before-taking.html we can estimate the space in bytes per tables that would be consumed without actually performing data pump export operation or in other word without generating dump file.

With help of ESTIMATE parameter of data pump export you can specify the method that Export will use to estimate how much disk space each table in the export job will consume (in bytes) before performing actual data pump export operation.

The ESTIMATE parameter can take two parameters. Either BLOCKS (default) or STATISTICS.

The meaning of these two parameter values are specified below.

BLOCKS: The estimate is calculated by multiplying the number of database blocks used by the target objects with the appropriate block sizes.

STATISTICS: The estimate is calculated using statistics for each table. So to be accurate you must analyze table recently.

Note that the outcome specified by ESTIMATE=BLOCKS is far away from the size of the actual dumpfile. In fact, ESTIMATE=BLOCKS method generates more inaccurate result from dump file size when,

a) The table was created with a much bigger initial extent size than was needed for the actual table data.

b) Many rows have been deleted from the table, or a very small percentage of each block is used.


The outcome generated by ESTIMATE=STATISTICS is most accurate to dump file size if recently table is analyzed.

Below is an example shown both in case of ESTIMATE=STATISTICS and ESTIMATE=BLOCKS. In both cases data pump export dump file is generated after estimation of dump file.

E:\>expdp schemas=arju userid=arju/a dumpfile=arju_11_01_blocks.dmp directory=test estimate=blocks
Export: Release 10.2.0.1.0 - Production on Thursday, 07 May, 2009 11:51:12

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

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "ARJU"."SYS_EXPORT_SCHEMA_03": schemas=arju userid=arju/********
dumpfile=arju_11_01_blocks.dmp directory=test estimate=blocks
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. estimated "ARJU"."SYS_EXPORT_SCHEMA_02" 320 KB
. estimated "ARJU"."SYS_EXPORT_SCHEMA_01" 128 KB
. estimated "ARJU"."AUTHOR" 64 KB
. estimated "ARJU"."BOOKAUTHOR" 64 KB
. estimated "ARJU"."BOOKS" 64 KB
. estimated "ARJU"."BOOK_CUSTOMER" 64 KB
. estimated "ARJU"."BOOK_ORDER" 64 KB
. estimated "ARJU"."ORDERITEMS" 64 KB
. estimated "ARJU"."PROMOTION" 64 KB
. estimated "ARJU"."PUBLISHER" 64 KB
. estimated "ARJU"."T" 64 KB
Total estimation using BLOCKS method: 1024 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "ARJU"."SYS_EXPORT_SCHEMA_02" 214.3 KB 1125 rows
. . exported "ARJU"."SYS_EXPORT_SCHEMA_01" 31.55 KB 12 rows
. . exported "ARJU"."AUTHOR" 5.835 KB 14 rows
. . exported "ARJU"."BOOKAUTHOR" 5.609 KB 20 rows
. . exported "ARJU"."BOOKS" 7.781 KB 14 rows
. . exported "ARJU"."BOOK_CUSTOMER" 8.234 KB 21 rows
. . exported "ARJU"."BOOK_ORDER" 8.398 KB 21 rows
. . exported "ARJU"."ORDERITEMS" 6.742 KB 32 rows
. . exported "ARJU"."PROMOTION" 5.710 KB 4 rows
. . exported "ARJU"."PUBLISHER" 6.265 KB 8 rows
. . exported "ARJU"."T" 4.914 KB 1 rows
Master table "ARJU"."SYS_EXPORT_SCHEMA_03" successfully loaded/unloaded
******************************************************************************
Dump file set for ARJU.SYS_EXPORT_SCHEMA_03 is:
E:\ORACLE\TEST\ARJU_11_01_blocks.DMP
Job "ARJU"."SYS_EXPORT_SCHEMA_03" successfully completed at 11:51:39

E:\>expdp schemas=arju userid=arju/a dumpfile=arju_11_01_statistics.dmp directory=test estimate=statistics
Export: Release 10.2.0.1.0 - Production on Thursday, 07 May, 2009 11:52:12

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

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "ARJU"."SYS_EXPORT_SCHEMA_03": schemas=arju userid=arju/********
dumpfile=arju_11_01_statistics.dmp directory=test estimate=statistics
Estimate in progress using STATISTICS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. estimated "ARJU"."SYS_EXPORT_SCHEMA_02" 187.0 KB
. estimated "ARJU"."SYS_EXPORT_SCHEMA_01" 36.67 KB
. estimated "ARJU"."BOOK_ORDER" 8.832 KB
. estimated "ARJU"."BOOK_CUSTOMER" 8.708 KB
. estimated "ARJU"."BOOKS" 8.156 KB
. estimated "ARJU"."ORDERITEMS" 6.808 KB
. estimated "ARJU"."PUBLISHER" 6.542 KB
. estimated "ARJU"."AUTHOR" 6.054 KB
. estimated "ARJU"."PROMOTION" 5.882 KB
. estimated "ARJU"."BOOKAUTHOR" 5.746 KB
. estimated "ARJU"."T" 5.061 KB
Total estimation using STATISTICS method: 285.5 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "ARJU"."SYS_EXPORT_SCHEMA_02" 214.3 KB 1125 rows
. . exported "ARJU"."SYS_EXPORT_SCHEMA_01" 31.55 KB 12 rows
. . exported "ARJU"."BOOK_ORDER" 8.398 KB 21 rows
. . exported "ARJU"."BOOK_CUSTOMER" 8.234 KB 21 rows
. . exported "ARJU"."BOOKS" 7.781 KB 14 rows
. . exported "ARJU"."ORDERITEMS" 6.742 KB 32 rows
. . exported "ARJU"."PUBLISHER" 6.265 KB 8 rows
. . exported "ARJU"."AUTHOR" 5.835 KB 14 rows
. . exported "ARJU"."PROMOTION" 5.710 KB 4 rows
. . exported "ARJU"."BOOKAUTHOR" 5.609 KB 20 rows
. . exported "ARJU"."T" 4.914 KB 1 rows
Master table "ARJU"."SYS_EXPORT_SCHEMA_03" successfully loaded/unloaded
******************************************************************************
Dump file set for ARJU.SYS_EXPORT_SCHEMA_03 is:
E:\ORACLE\TEST\ARJU_11_01_STATISTICS.DMP
Job "ARJU"."SYS_EXPORT_SCHEMA_03" successfully completed at 11:52:25

Using ESTIMATE=BLOCKS, before data pump export size is shown as 1024 KB and using ESTIMATE=STATISTICS, before data pump export size is shown as 285.5 KB and my actual dump file size was 472KB which is far away from estimation using ESTIMATE=BLOCKS as difference is 1024-472=552. In later case difference is 186.5.

Note that if a table involves LOBs, the dump file size may vary as ESTIMATE does not take LOB size into consideration.

Related Documents

ORA-39000, ORA-39143 dump file may be an original export dump file

Problem Description
E:\>impdp directory=test dumpfile=testexp_07_03_09.dmp userid=arju/a

Import: Release 10.2.0.1.0 - Production on Thursday, 07 May, 2009 10:07:00

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

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-39143: dump file "E:\oracle\Test\testexp_07_03_09.dmp" may be an original export dump file

Cause of the problem
The above problem happened whenever you try to use the Import Data Pump client (impdp) to import a dumpfile that was created with the original Export client (exp).

Though not related but similar error occured.
Like whenever you try to import from an empty file,
E:\>impdp directory=test dumpfile=testexp_07_03_09.dmp userid=arju/a

Import: Release 10.2.0.1.0 - Production on Thursday, 07 May, 2009 10:16:52

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

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31619: invalid dump file "E:\oracle\Test\testexp_07_03_09.dmp"
ORA-27091: unable to queue I/O
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 38) Reached the end of the file.

Whenever you try to import from invalid dump file or corrupted dump file then you may get following error,

E:\>impdp directory=test dumpfile=testexp_07_03_09.dmp userid=arju/a

Import: Release 10.2.0.1.0 - Production on Thursday, 07 May, 2009 10:17:23

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

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31619: invalid dump file "E:\oracle\Test\testexp_07_03_09.dmp"

Solution of the Problem
It is obvious that,
-Data pump export client(impdp) can't read file created by the original export client (exp).

and,

-Data exported by data pump client(expdp) can't be readable by original import client(imp).

So to import dumpfile that was created with the original Export client (exp) you must have to use imp.

Like,
imp userid=arju/a file=e:\oracle\testexp_07_03_09.dmp

Otherwise you can export the dumpfile using expdp and then try impdp while importing.

Related Documents
http://arjudba.blogspot.com/2009/02/how-to-do-data-pump-import-from-higher.html
http://arjudba.blogspot.com/2008/04/data-pump-exportimport-how-we-can-do-it.html
http://arjudba.blogspot.com/2009/02/ude-00018-data-pump-client-is.html
http://arjudba.blogspot.com/2008/04/exportimport-datapump-parameter-query.html

Sunday, May 3, 2009

Expdp fails with ORA-39001,ORA-39169,ORA-39006,ORA-39022

Problem Description
Connecting to local 10.2.01 database whenever I want to take data pump export into remote 11g database machine using NETWORK_LINK parameter data pump export fails with ORA-39001, ORA-39169 as below.
[oracle@localhost bin]$ ./expdp system/a NETWORK_LINK=maestro.net schemas=maximsg VERSION=10.2

Export: Release 10.2.0.1.0 - Production on Wednesday, 04 March, 2009 5:27:39

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

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORA-39001: invalid argument value
ORA-39169: Local version of 10.2.0.1.0 cannot work with remote version of 11.1.0.6.0.

Similarly, connecting to local 10.1.0.* database whenever I want to take data pump export into remote 11g database machine using NETWORK_LINK parameter data pump export fails with
ORA-39006: internal error
ORA-39022: Database version 11.1.0.6.0 is not supported.

Doing expdp/impdp connected to a local 10.2.0.3 database fails with,

ORA-39127: unexpected error from call to export_string
:=SYS.DBMS_CUBE_EXP.schema_info_exp('ARJU',1,1,'11.01.00.00.00',newblock)
ORA-37118: The OLAP API library was not preloaded.
ORA-06512: at "SYS.DBMS_CUBE_EXP", line 205
ORA-06512: at "SYS.DBMS_CUBE_EXP", line 280
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5980
ORA-39125: Worker unexpected fatal error in KUPW$WORKER.UNLOAD_METADATA
while calling DBMS_METADATA.FETCH_XML_CLOB [TABLE_STATISTICS]
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified:
ORA-22275
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.KUPW$WORKER", line 6234

Doing expdp/impdp connecting to a local 10.2.0.4.0 database
...
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.MAIN [INSERT
INTO sys.ku$_list_filter_temp@tiger SELECT process_order, duplicate,
object_name, base_process_order FROM "SYSTEM"."SYS_EXPORT_SCHEMA_01"
WHERE process_order = :1]
ORA-00947: not enough values
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPW$WORKER", line 6345

Cause of the Problem
The error occurred due to several oracle bugs. Whenever it is attempted to export data over a database link initiated from lower database compatibility level to a higher compatibility level it fails due to bug. That is if data pump export operation is started on a local 10.x database with NETWORK_LINK parameter and then the database link connects to a remote 11.x database then the Data Pump job may fail due to several defects.

As you see above, error messages displayed vary from version to version.

The errors ORA-39006 and ORA-39022 displayed if a Data Pump job with NETWORK_LINK is started on a local 10.1.x database and the database link connects to a remote 10.2.x or 11.x source database.

The errors ORA-39001 and ORA-39169 displayed if a Data Pump job with NETWORK_LINK is started on a local 10.2.0.1 or 10.2.0.2 database and the database link connects to a remote 11.x source database.

The errors ORA-39127 and ORA-37118 displayed if a Data Pump job with NETWORK_LINK is started on a local 10.2.0.3 database and the database link connects to a remote 11.x source database.

The errors ORA-39126 and ORA-00947 displayed if a Data Pump job with NETWORK_LINK is started on a local 10.2.0.4 database and the database link connects to a remote 11.x source database.

Note that compatibility settings of remote database is not an issue here.


Solution of the Problem
Solution 01:
- Do data pump export operation without NETWORK_LINK parameter.
- Transfer the data pump export file on the the other server.
Solution 02:
With usage of NETWORK_LINK parameter,
- Make sure that local connecting database is a 10.2.0.3.0 or higher release database.
- Explicitly use VERSION=10.2 while doing expdp operation.

Related Documents