How to export/import full OracleDB data dump? - oracle

I am new to Oracledb. please help me to export whole data Dump and import same to another db to create another copy of database.

You need an administrative account (for example SYSTEM). Assuming you have this, the steps are:
create a directory object inside the database to map to a physical directory on both source and target
export the source database
import into the target database
For example
SQL> create directory X as '/u01/big_directory';
expdp system/mypassword#source full=Y directory=X dumpfile=full.dmp logfile=fullexp.log
impdp system/mypassword#target full=Y directory=X dumpfile=full.dmp logfile=fullimp.log
Also, check the "Database Utilities" guide in the standard Oracle documentation set for your release at docs.oracle.com

Related

Export & Import in SQL DEVELOPER without datapump

I want to export below things from SQL developer
1-Only schema (tables structure)
2-Only data in excel form
3-Schema with data
after exporting this i want to import the same to the another database
So what steps should i follow for export and import?
I can not use DATA PUMP as i don't have DBA privilege
As you use Oracle 11g, I'd suggest you to forget about SQL Developer and use the original EXP and IMP utilities. Doing so, you'd avoid DBA-related-problems as these utilities don't require access to the directory (an Oracle object which points to (usually database server's) filesystem directory, and - in order to be able to use it - you'd need to have read/write privileges on it).
So - if you don't already have these, install Oracle Client which contains EXP/IMP and use them.

ORACLE DB exp with FULL=y option cannot export all user tables but expdp can

I am trying to use the exp tool to backup the whole DB.
The command is "exp userid=system/manager#test inctype=complete buffer=65535 file=/home/oracle/backup/exp_full.dmp log=/home/oracle/backup/exp_full.log full=y".
But from the exp log, it can only export some user tables, not all, even though those tables cannot exported indeed have content. Only these users can be exported from the log as below:
. about to export SYSTEM's tables via Conventional Path ...
. about to export OUTLN's tables via Conventional Path ...
. about to export ORDDATA's tables via Conventional Path ...
. about to export OLAPSYS's tables via Conventional Path ...
etc.
But when I try to use expdp with command expdp system/manager dumpfile=expdp_full.dmp logfile=expdp_full.log full=y, it can export all user tables successfully.
The ORACLE DB version is 11.2.0.1.0.
Appreciate for your help.
you need to specify which schema you want to export , by expdp user/password schema=abc dumpfile=abc.dmp logfile=abc.log directory=abcdirectory
Oracle Database Online Documentation Library, 11g Release 2 (11.2)
Original Export is desupported for general use as of Oracle Database
11g. The only supported use of original Export in Oracle Database 11g
is backward migration of XMLType data to Oracle Database 10g release 2
(10.2) or earlier. Therefore, Oracle recommends that you use the new
Data Pump Export and Import utilities, except in the following
situations which require original Export and Import: You want to
import files that were created using the original Export utility
(exp).
You want to export files that will be imported using the original
Import utility (imp). An example of this would be if you wanted to
export data from Oracle Database 10g and then import it into an
earlier database release.

impdp in Oracle. Why it does not create users?

I am newbie in oracle and I am facing troubles with impdp. I have a production server and I have created a new server for testing purposes, so I installed centos, oracle and created the database "sire". Now I make a dump from the production server with the following command:
expdp system/password#sire full=Y
directory=pump_dir dumpfile=sire_dump.dmp logfile=sire.log
The I come to the new server, and I execute impdp:
impdp system/password#sire full=Y
directory=pump_directorio dumpfile=sire_dump.dmp logfile=sire_imp.log
It starts to do the import but then I receive errors such as:
"the user vberrios does not exist". And also error beause it cannot
found some schemas and tablespaces.
My question is: It is not supposed that impdp full=Y must import all users and schemas? I have read that I have to create the users in the destination server but I have about 300 users in the database. How can I do a full import in a empty server. I just want to import the full database and user and all objects.
The documentation states, that impdp will create uses, when the dump file contains the create user statements:
If the schema you are remapping to does not already exist, the import
operation creates it, provided the dump file set contains the
necessary CREATE USER metadata and you are importing with enough
privileges.
So either your dump file is incomplete (for example due to missing privileges) or you are lacking privileges on the target database.
So please check your privileges on both, the source database and the target database. Please update your question with then according information. For the export to include the schema definitions, you must have the DATAPUMP_EXP_FULL_DATABASE privilege.

How to create a dump?

I'm one of the junior DBA working in IT company.In my company there are so many schemas is there.Now my question is How to create a dump file(some times i'm working at home.That time how to use that dump file ).Please suggest me
NOTE:I am using Oracle SQL Developer.
Expdp helps in exporting the database and impdp helps in importing the database. you can directly export one schema to another (in different database also) by using network link concept.
If network link concept is used then the creation of separate expdp file is not required.
For example If you have to export a schema called schema1 with password pwd1 from source database to target database then
first you need admin privileges of your target and source schema.
You can create a network link between source and target schema
CREATE PUBLIC DATABASE LINK example_link
CONNECT TO schema1 IDENTIFIED BY pwd1
USING 'server_name:port/service_name';--(put source database server_name,port and service name)
then create a directory in your target server :-
CREATE OR REPLACE DIRECTORY exp_dir AS 'F:/location';
grant read,write on directory exp_dir to schema1;
After this login to your target server and from command line use the below command:
impdp dba_username/dba_pwd network_link=example_link directory=exp_dir remap_tablespace=source_tbs:target_tbs remap_schema=schema1:schema1 parallel=2
You should use the Oracle Data Pump tool. The tool allows you to export your data into a .dmp file and import it into any database. Here is a video showing how to use the data pump tool in SQLDeveloper. I think this is a relatively new feature in SQLDeveloper, so make sure you have the appropriate versions..
Video Tutorial HERE
From the command line, you can use data pump with the expdp and impdp commands like so..
Set your oracle environment by running the below command and providing your oracle SID
. oraenv
Then you can run your export command..
expdp directory=/bu1/dpdump/ dumpfile=myexport.dmp logfile=mylog.log schemas=users,products,sales
The parameters are as follows..
directory - the directory where to create the dumpfile and log
dumpfile - name of the dump file (should end in .dmp)
logfile - name of the log file (should end in .log)
schemas - comma seperated list of the schemas you want to export
NOTE: you need dba privileges to use datapump. It will prompt you for the credentials
Data Pump Documentation is here
Exporting of ORACLE database objects is controlled by parameters. To get familiar with EXPORT parameters type:
exp help=y
You will get a short description and the default settings will be shown.
The EXPORT utility may be used in three ways:
Interactive dialogue
Controlled through bypassed parameters
Parameterfile controlled
Example to the 2nd option:
exp scott/tiger file=empdept.expdat tables=(EMP,DEPT) log=empdept.log
Take a look at these links for further readings:
Original Export and Import
The ORACLE Import/Export Utilities

Oracle: Recover backup in other different than original server

I'm really newbie about Oracle backup operations. I'm really new in this world and I need to know how to backup a DB schema and restore it in another machine under another schema name.
I cannot afford any mistake since I'll be doing this in our customer site, an making a small mistake could be the last one
I don't want to sound offensive, but doing this in MySQL is really easy, like this:
in server one:
$mysqldump --user=user --password=password db_to_backup > bc_name.sql
-after transfering the sql script to another server
in server two:
mysql>create database db_to_restore;
$mysql --user=user --password=password db_to_restore < bc_name.sql
I need to do the same using Oracle, I read some documentation but I'm still unsure how to do it:
First: What's the equivalent of MySQL database in Oracle? tablespace?
Second: I think these are the steps to get a backup
mkdir /opt/oracle/dumptmp/
CREATE OR REPLACE DIRECTORY dumptmp AS '/opt/oracle/dumptmp/';
expdp user/pass#tablespace directory=dumptmp dumpfile=dumptmp:full.dmp logfile=dumptmp:full.log full=y
Third: Then I move the file "full.dmp" to the other server, but I'm not sure how to restore my backup file full.dmp into a new tablespace with a different name to the one it the backup was gotten from:
SQLPLUS>create tablespace ts_something;
then I'm not sure how to proceed from here. Please advice me how to do it using command line commands since my customer does not have GUI tools intalled.
Thanks a lot!
First of all, make sure you test this procedure in test or development environments before proceeding to perform it on production. Disclaimer: I'm not responsible if you bust any of your databases by misusing the following advice. Note that I'm also ignoring how tablespace storage is set up for your schemas, which you should definitely hold in consideration when creating new schemas.
Here is the simplest possible method using command line. You will need to use exp and imp utilities which come with complete Oracle database distributions. Assuming that you have the path to Oracle executables set correctly in your environment path, you will need to do:
Export your source schema on the source database server:
[oracle#src_server ~]$ exp source_schema_username#SRC_SID owner=source_schema_username file=source_schema.dmp
Import your source schema into destination schema on the destination database server (assuming you have already created the destination schema, if not, see CREATE USER, also make sure that destination schema user has RESOURCE role):
[oracle#dst_server ~]$ imp system#DST_SID fromuser=source_schema_username touser=destination_schema_username file=source_schema.dmp
Note that you must run imp as a user that has DBA role. I'm using system here because this user typically exists on all Oracle databases and has DBA role. You will of course need to know the password for system user. You may not need to specify SIDs if ORACLE_SID is already set in your environment on both servers (echo $ORACLE_SID), however I wanted to be explicit here to make sure that you do not import into the wrong database.
For more information on usage of export and import utilities run exp help=y and imp help=y.
To answer your questions about Oracle:
First: What's the equivalent of MySQL database in Oracle? tablespace?
Oracle equivalent is database name (db_name parameter). It identifies a database on Oracle database server(s). On a single instance database, this is also typically Oracle SID. On Oracle RAC, a single database will have many SIDs.
Third: Then I move the file "full.dmp" to the other server, but I'm not sure how to restore my backup file full.dmp into a new tablespace with a different name to the one it the backup was gotten from:
You want to create a new user, which is identical to a schema in Oracle. Tablespaces are abstracted collections of disk locations where Oracle stores tables and indicies. For example, when you create a table, it has to be assigned to some tablespace.
What you're explaining is not really a backup, more like schema export & import.
but doing this in MySQL is really easy.
So is doing the same in Oracle.
exp user/password#hoststring file=bc_name.dmp log=bc_name.log full=y statistics=none
& to import it,
imp new_user/new_password#hoststring file=bc_name.dmp log=bc_name.log full=y
If new_user doesn't exist then create the users
create user new_user identified by new_password
and grant the rights
grant create session,connect,imp_full_database to new_user

Resources