Connecting to oracle database using tnsname.ora with liquibase - oracle

I want to use liquibase to automate database deployments. Our setup is tnsnames.ora file is located on a shared drive \\shared\drive\path\tnsnames.ora
As per docs from liquibase, liquibase.properties files should look something like as below.
--driver=oracle.jdbc.OracleDriver
--classpath=ojdbc14.jar
--url="jdbc:oracle:thin:#<IP OR HOSTNAME>:<PORT>/<SERVICE NAME OR SID>"
--changeLogFile=db.changelog-1.0.xml
--username=<USERNAME>
--password=<PASSWORD>
Is there any way by which we can just specify <SERVICE NAME OR SID> which get the matching SERVICE NAME from tnsname.ora file located on the network share and connect to the required database ?

Have you tried using Liquibase built into SQLcl? SQLcl version 20.4 has Liquibase version 4.1.1 embedded within it so you can connect to the database using the same syntax that you would use for SQLPlus, then run your Liquibase commands from there.
C:\Users\ej>sql scott/tiger#tnsalias
SQLcl: Release 20.4 Production on Fri Mar 05 11:07:13 2021
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Last Successful login time: Fri Mar 05 2021 11:07:14 -05:00
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0
SQL> lb version
Liquibase version: 4.1.1
Extension Version: 20.4.1.0
SQL> lb help
usage: lb COMMAND ...
Commands:
The following commands are available within the liquibase feature.
lb help COMMAND for command specific help
COMMAND
genobject Generate change log for a specific database object
genschema Generate changelogs and controller for connected schema
data Generate changelog for the data in tables
gencontrolfile Generate a blank controller.xml as a sample
update Updates database to current version
updatesql Generates SQL to update database to current version
rollback Rolls back the state requested
rollbacksql Writes SQL to roll back the database to the state requested
diff Writes description of differences between two databases to standard out.
dbdoc Generates Javadoc-like documentation based on current database and change log.
changelogsync Mark all changes as executed in the database.
clearchecksums Removes current checksums from database. On next update changesets that have already been
deployed will have their checksums recomputed, and changesets that have not been deployed will
be deployed.
listlocks Lists who currently has locks on the database changelog.
releaselocks Releases all locks on the database changelog.
status Outputs list of unrun change sets.
validate Checks the changelog for errors.
version Display product version information

Related

Import dmp file to Oracle

my customer has provided a dmp file (10 GO), and i tried the following:
Create a user:
create user USERNAME identified by PASSWORD;
Grant read write access
Import the dump file(using imp and impdp)
impdp or imp system/password#db dumpfile=EXPDAT.DMP FULL=Y logfile=dice.log
and here's the error message:
Import: Release 18.0.0.0.0 - Production on Tue Feb 23 11:46:07 2021
Version 18.4.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
ORA-39002: invalid operation
ORA-39059: dump file set is incomplete
ORA-39246: cannot locate master table within provided dump files
Can anyone help on that?
First, imp and impdp are not interchangeable; they have different file formats and options. You need to know exactly which was used to create the file you have.
Second, assuming the file was created with expdp (aka datapump, the more modern choice) and you should be using impdp to load it, the error indicates that there's a problem with the datafile itself.
ORA-39246 cannot locate master table within provided dump files
Cause: Check the export log file and make sure all of the files that
were exported are included in the current job.
Action: A Data Pump IMPORT or SQL_FILE operation was being performed
but not all of the files from the Data Pump export dump file set were
included. In particular, the dump file containing the export job's
master table was not provided.
It seems likely that your customer has not provided you with the complete data dump and you should have received additional files. This is possible if either the "parallel" or "filesize" option was used during the export. Confirm with them the number and size of the files you should have.

Importing an Oracle 7 DMP into Oracle XE 18c

I need to be pointed in the right direction, as I am getting nowhere.
I have been handed a project from some years back which has a VB6 front end with an Oracle back end, and for some reason Access in the middle. The VB6 I am fine with.
What I am trying to achieve is to import an Oracle 7 DMP file into a fresh install of Oracle XE 18c.
What I need is to be pointed towards some documentation with examples, and maybe an area to look at. I am new to Oracle so really have no clue where to begin.
Where I am currently:
I have downloaded and installed a copy of Oracle on my Windows 10 PC (64Bit)
Copied the DMP file into the correct directory.
Ran the following command, and I get the errors that follow
D:\Oracle\ImportDB>impdp dumpfile=BA0211070.DMP
Import: Release 18.0.0.0.0 - Production on Wed Mar 27 11:04:58 2019
Version 18.4.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
Username: SYSTEM
Password:
Connected to: Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31619: invalid dump file "D:\Oracle\admin\xe\dpdump\BA0211070.DMP"
I have also tried:
impdp dumpfile=BA0211070.DMP FULL=Y VERSION=7
impdp dumpfile=BA0211070.DMP FULL=Y
I got the same results as above.
I have tried Googling the error messages, but that hasn't really shed much light. I can't get a fresh DMP file as we don't have an Oracle installation anymore, so unfortunately I have to work with what I have.

is it possible to recover the Oracle Data Pump master table?

I'm trying to import a few files with a published Oracle Data Pump perl script: dumpinfo.pl
After successfully importing several dump files from the same export process, another file failed with:
# impdp system/****** DIRECTORY=RESTORE_DIR DUMPFILE=exp_%u.dmp PARALLEL=8
Import: Release 11.2.0.2.0 - Production on Mon Jul 7 11:40:37 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-39002: invalid operation
ORA-39059: dump file set is incomplete
ORA-39246: cannot locate master table within provided dump files
The script reports that it can't find a master table. Assuming that the master table is lost, there any mechanics for recover it?
Thanks...
ORA-39246 cannot locate master table within provided dump files
Cause: Check the export log file and make sure all of the files that
were exported are included in the current job. Action: A Data Pump
IMPORT or SQL_FILE operation was being performed but not all of the
files from the Data Pump export dump file set were included. In
particular, the dump file containing the export job's master table was
not provided.
Check that you have all dump files in that directory and they all are accessible to impdp utility. I got this error when our backup team has restored first five dmp files, and two last ones were missing.

Oracle and rman recovery catalog

I have been handed an oracle database (10.1.0.5.0) with no documentation and very little rman information and I need to change the existing the backup location drive for rman backups.
Before I do that I want to check if the database has a recovery catalog. How do I do this?
If no recovery catalog exists how to do I query existing script names and script content?
What platform are you on?
The CATALOG option will be on the RMAN command line or in the recovery script file. Just "grep" for catalog as a start.
Please check your RMAN backup log file. Where you will see where you are connecting to catalog or not.
The output will look like as below
Recovery Manager: Release 12.1.0.2.0 - Production on Thu May 2 08:03:55 2019
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
RMAN>
connected to recovery catalog database
recovery catalog schema release 12.02.00.01. is newer than RMAN release
Check your backup script where you will see where you are connected to RMAN Catalog or not
Please grep for "connect catalog"
$ cat script.sh | grep 'connect catalog'

Error importing oracle dump

I am trying to import a dump into two schema in the same oracle DB.Following a workaround to do this.
I am trying to run the imp command with the INDEXFILE option to be able to modify the tablespace names in the sql. This is what I get :
E:\oracle_10_2\BIN>imp atlantis/atlantis#orcl file=ABCD1_EXCLUDE_CLOB_TABS_BAK.dmp indexfile=index.sql full=y log=imp.log
Import: Release 10.2.0.1.0 - Production on Thu Mar 12 15:31:44 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Produc
tion
With the Partitioning, OLAP and Data Mining options
IMP-00002: failed to open ABCD1_EXCLUDE_CLOB_TABS_BAK.dmp for read
Import file: EXPDAT.DMP >
Looked like a file permission issue to me so I tried changing it.
E:\oracle_10_2\BIN>cacls E:\ABCD1_EXCLUDE_CLOB_TABS_BAK.dmp /p atlantis:F
Are you sure (Y/N)?y
processed file: E:\ABCD1_EXCLUDE_CLOB_TABS_BAK.dmp
E:\oracle_10_2\BIN>cacls E:\ABCD1_EXCLUDE_CLOB_TABS_BAK.dmp
E:\ABCD1_EXCLUDE_CLOB_TABS_BAK.dmp CORP\atlantis:F
But the problem persists.
If you are using Oracle 10g consider using new export/import tool Oracle Data Pump in which you can use REMAP_TABLESPACE parameter.
Anyway, you missed the path of the exportfile (bassed on the commands fo give permissions). Then You wrote:
file=ABCD1_EXCLUDE_CLOB_TABS_BAK.dmp
instead of
file=E:\ABCD1_EXCLUDE_CLOB_TABS_BAK.dmp
Then, the result export command to work is:
imp atlantis/atlantis#orcl file=E:\ABCD1_EXCLUDE_CLOB_TABS_BAK.dmp indexfile=index.sql full=y log=imp.log
Open window command line as administrator
imp user/pass#databasename(listenername) file='DMP path'
log=indexfile.log full=y;
Don't forget to add your database or listener name.

Resources