I am exporting a database on Oracle from Linux to Windows.
I have already tried all of the answers on Stack Overflow.
When using exp, I receive this:
Message 206 not found; No message file for product=RDBMS, facility=EXP
Copyright (c) 1982, 2009, Oracl
Invalid format of Export utility name
Verify that ORACLE_HOME is properly set
Export terminated unsuccessfully
EXP-00000: Message 0 not found; No message file for product=RDBMS, facility=EXP
I have exported the ORACLE_HOME, ORACLE_SID, and PATH:
export ORACLE_HOME=u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=xe
export PATH=$PATH:$ORACLE_HOME
I have also tried using expdp and this gives me this error:
UDE-00013: Message 13 not found; No message file for product=RDBMS, facility=UDE
UDE-00019: You may need to set ORACLE_HOME to your Oracle software directory
I am really stuck for answers now.
Thanks for any help in advance.
EDIT:
Oracle_env.sh
Your ORACLE_HOME path is wrong, it's missing the initial /. That means he Oracle tools can't see the files they need, hence the errors you're seeing. Your modification of the PATH should also be adding the bin directory within that home:
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=xe
export PATH=$PATH:$ORACLE_HOME/bin
If you put those commands into a file then you have to source the file so make the changes apply to your current session. You can also set them directly in your shell profile script (e.g. ~/.bash_profile), by copying those three lines into that file - they will then be set automatically for future log ins.
Oracle provide a file to set up the environmet, so instead of setting these yourself you could do:
. /u01/app/oracle/product/11.2.0/xe/oracle_env.sh
either manually each time you log in, or more usefully by adding that line to your shell profile script.
Related
One simpler way is:
Go to https://apex.oraclecorp.com then login into the workspace using credentials.After that click on SQL scripts and proceed to download or export the SQL's.
But is there any way by which we can directly export/download all the sql files via command line ?
You can quickly export Apex applications through the command line, avoiding the Apex UI completely. To do this, Oracle has provided two java classes, which are included in the Apex download:
APEXExport.class
APEXExportSplitter.class
These classes are located in the apex/utilities/oracle/apex directory.
Before using these classes, you have to make sure that the following environment variables are set up correctly:
ORACLE_HOME should point to just that. Something like:
/u01/app/oracle11g/product/11.2.0/db1
APEX_HOME should point to the directory where you unzipped the Apex download. For example
/u01/downloads/apex
PATH needs to include $ORACLE_HOME/jdk/bin
CLASSPATH needs to include:
$ORACLE_HOME/jdbc/lib/ojdbc5.jar
$APEX_HOME/utilities
Note: You may also have to include the . path.
APEXExport
To execute the export use
$ java oracle.apex.APEXExport
You can get a list of the available arguments by executing the above command without arguments. For a basic application export use:
$ java oracle.apex.APEXExport -db localhost:1521:db1 -user scott -password tiger -applicationid 100
You’ll get a message saying: Exporting application 100.
Once the export is done you’ll see an *sql file in your current directory (e.g. f100.sql).
APEXExportSplitter
You can now take the export file and split it up into its various components. This is handy if, for example, you want to examine the SQL of an application page or two.
$ java oracle.apex.APEXExportSplitter f100.sql
This program creates a directory named after your application (e.g. f100) and multiple sub directories which contain the various components of the application.
I am using data pump to perform an import on 4 .dmp files and keep on receiving the set of errors as below:
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation
I am new to oracle and cannot find a helpful solution.
I am performing the import as in here, although I'm using oracle 12c.
The command I run in the windows command like looks like this:
impdp user/pass#db_name directory=DUMP_DIR dimpfile="file_name.dmp" schemas=schema_name content=all parallel=4
DUMP_DIR is created in oracle and appropriate privs were granted.
I also ran this command with
... logfile=file_name.log
added at the end but I'm not sure if the log file was created or where it was saved.
I have found this - it's about exactly the same set of errors but on export and on linux. At the end of the answer there's a sentence 'If we are on a Windows machine, then we need to make sure that both the listener and the database have been started with the exact same username.' Is this useful in case of import? If yes - what does it mean exactly?
There's a great short answer here, which is basically "The database isn't able to write to the log file location."
The link above suggests a simple test to troubleshoot the issue.
declare
f utl_file.file_type;
begin
f := utl_file.fopen ('DUMP_DIR', 'test.txt', 'w');
utl_file.put_line(f, 'test');
utl_file.fclose(f);
end;
/
If this fails, Oracle can't write to that directory at all, probably because of Windows file permissions. Check which Windows user(s) the Oracle services are running as, and change the folder permissions to allow them write access.
If that worked, it's a problem specific to impdp. You might try changing your command string - one option might be to specifically write your log file to a different Oracle directory, e.g. logfile=DATA_PUMP_DIR:file_name.log.
If none of these options work, you can also disable the logfile completely by using NOLOGFILE=Y, but you'll have to monitor the impdp output on your console, because it won't get saved anywhere else.
The problem You have is Your Oracle is not able to write to DIRECTORY (DUMP_DIR) you specified.
In Windows 10, It behaves unpredictably. Solution
Create another Oracle directory with preferably in C:\Users\Public\ folder, where you are 100% sure access would not be issue. CREATE OR REPLACE DIRECTORY DUMP_DIR_2 AS 'C:\Users\Public\<name>
Give Grants GRANT READ, WRITE ON DIRECTORY DUMP_DIR_2 TO schema_name;
Copy your dump file to newly created folder.
Fire your import command
First is very important the Oracle have the permission to write and read the folder. If you already test this, try the solution bellow:
I had the same situation, in my case the command was (password is only for an instance) :
impdp 'sys/passExample as sysdba' directory=C:/oracle/oradata/EXEMPLODB dumpfile=preupd.bak
I put the preup.bak into the folder EXEMPLODB
The correct is change the directory folder by the name of directory, the correct command is:
impdp 'sys/passExample as sysdba' directory=EXT_DATA_FILES dumpfile=preupd.bak
The EXT_DATA_FILES is the directory name, I found with the query
select * from all_directories;
into the system db.
I have ubuntu 14.04 and oracle XE 11
if to execute a file sql from Oracle i do :
SQL > # /........./Desktop/file.sql
how change the a path of oracle , Means I create file in Desktop
and i do :
SQL > # file .sql
You can set the $SQLPATH environment variable before running SQL*Plus. From the documentation:
SQLPATH - Environment variable or Windows registry entry to specify the location of SQL scripts. SQL*Plus searches for SQL scripts, including login.sql, in the current directory and then in the directories specified by SQLPATH, and in the subdirectories of SQLPATH directories. SQLPATH is a colon separated list of directories. There is no default value set in UNIX installations.
So:
export SQLPATH=/........./Desktop
sqlplus
Alternatively, just cd to the Desktop directory before launching SQL*Plus, as it will look for scripts in the current directory first anyway.
#alex poole for the win!
A small additional thought; just like the unix PATH variable, you can have several paths defined in the SQLPATH variable, so sqlplus can look in several locations to find the referenced script.
I am trying to get create a TNS connection in SQL Developer on my mac laptop (OS X 10.9.5).
I get this error no ocijdbc11 in java.library.path I googled around and found out that I need to
install oracle's instant client. I found the instance client files here :
http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
The files are just zip files that you need to download and extract somewhere.
Then I found the instructions that actually tell you what to do with the zip files here:
https://docs.oracle.com/cd/E11882_01/install.112/e38228/inst_task.htm#BABHEBIG
The instructions say that :
Set the DYLD_LIBRARY_PATH and the NLS_LANG environment variables
to the full path of the instantclient_11_2 directory. For example,
if you unzipped the Instant Client zip file in the /bin/oracle
directory, then set the DYLD_LIBRARY_PATH environment variable to
/bin/oracle/instantclient_11_2.
What the instructions do not tell me is HOW to set environment variables permanently and how to make the environment variables accessible to GUI tools like SQL developer.
Has anyone gotten SQL Developer to work with instantclient?
Based on the answer of #Alex Poole: In El Capitan when SIP is enabled, this doesn't seem to work, because the DYLD_LIBRARY_PATH environment variable doesn't get transferred to the environment that bash ./sqldeveloper starts (last line of the SQLDeveloper.app/Contents/MacOS/sqldeveloper.sh) .
Solution: instead of editing the file SQLDeveloper.app/Contents/MacOS/sqldeveloper.sh I edited the file SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/sqldeveloper and added the export DYLD_LIBRARY_PATH=/path/to/instantclient line there.
#!/bin/bash
export DYLD_LIBRARY_PATH=/path/to/instantclient
#=============================================================================
# Launcher for Oracle SQL Developer
# Copyright (c) 2005, Oracle. All rights reserved.
#=============================================================================
...
If you're comfortable editing files, you can set the library path in the internal startup script. I edited this through Terminal.app and vim, by going to:
cd <wherever SQL Developer was installed/unzipped>
cd SQLDeveloper.app/Contents/MacOS
cp -p sqldeveloper.sh sqldeveloper.sh.backup
chmod o+w sqldeveloper.sh
vim sqldeveloper.sh
The file is protected by default, so I'm changing it to be writable (and making a backup first, just in case). If you skip that step, with vim you can save it with :w! to save it anyway.
Alternatively find the SQLDeveloper application in Finder, right click, and choose 'Show Package Contents', then drill down to Contents->MacOS, right-click the sqldeveloper.sh file and choose 'Open With' and your favourite text editor - TextEdit will do. As the file is locked you will be prompted to unlock it at some point - maybe on open or first edit, but TextEdit will ask you if you want to unlock it when you save.
However you get into the file, you can then specify add a line to set/export DYLD_LIBRARY_PATH:
#!/bin/bash
# Next line added for TNS connections
export DYLD_LIBRARY_PATH=/path/to/instantclient
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
here="${0%/*}"
cd "${here}"
cd ../Resources/sqldeveloper/sqldeveloper/bin
bash ./sqldeveloper -clean >>/dev/null
... where /path/to/instantclient is your unzipped directory; in the quoted example above, that would be /bin/oracle/instantclient_11_2. Also note that this needs to be the 64-bit instant client; it will complain about the wrong architecture if you try to use the 32-bit version.
One the modified file has been saved, relaunch SQL Developer and your TNS connection should now work. If you want to be able to use a TNS alias you can also set/export a TNS_ADMIN variable that points to a directory containing a tnsnames.ora file.
I have .dmp and .log files. I need to recover the database schema and data using SQLPlus or some feature of EX. How do I do that? I've tried the RECOVER command and impdp. No luck, or I'm doing something wrong.
What version of Oracle? How was the .dmp file created? You can look at the first line in your .dmp file (assuming it's a file produced by exp) to get the version of the utility that dumped it. Likely, you will need to use imp, although I don't know what problems you were experiencing with impdp - error messages and the command line being used would be helpful. Assuming this was produced by exp, RECOVER will not help.
Can you use "imp Scott/Tiger#Machine file=MyDump.dmp" in EX?
P.S: I Assume Oracle Ex == Oracle Express
open command prompt and type imp user/password#db
you will be prompt to provide the file and path.
if you get message like:
IMP-00010: not a valid export file, header failed verification
IMP-00000: Import terminated unsuccessfully
this means that the file was created with data pump or that the source version is newer.
if not, follow the prompt it should be really straight forward.