Can we recreate pdb$seed in Oracle database 19c - oracle

I have lost by mistake the pdb$seed from my multitenant architecture of database.
Is there some possible way to recreate the same?

If you happen to have a regular PDB that was created from the seed database, you can close this regular PDB into a new seed database.
If you have already made changes to the regular PDB, the easiest is to create a (temporary) new CDB (which comes with a fresh seed database) using the Database Creation Assistant and clone the seed database from the temporary CDB to your CDB. After that, drop the temporary CDB.

Related

Reading and Updating data of Oracle DB without License

I've got to update the data of an Oracle DB but I'm not the owner and ain't got any Oracle License.
The goal is to explain to my interlocutor how to create a dump from his Oracle DB, to find out how to restore this dump in a DB (a free version of Oracle or something else), update some data in some tables, and then make another dump to send it back to my interlocutor.
So the differents questions I have are:
1- Is it possible to create a dump (maybe in SQL format) without any specifics dependencies to Oracle ?
2- Is there a way to restore this dump in a free lightweight Oracle, or another kind of DB like Postgresql ?
3- Does Oracle, is able to handle any kind of dump et restore it in an Oracle DB or is there any constraints to respect ?
I am very new to Oracle and ain't got, on my personal computer, any possibility to try out the dump/restore by myself; that's why, any help will be appreciated !
1- Is it possible to create a dump (maybe in SQL format) without any specifics dependencies to Oracle ?
Oracle offers Data Pump utilities (export and import) for such purposes. You'd export table (or schema) - result is a ".dmp" file, readable by import utility. You'd then move that file to your own server (see #2 for the rest)
2- Is there a way to restore this dump in a free lightweight Oracle, or another kind of DB like Postgresql ?
On your own server (which could be a laptop; no problem), you'd install a free Oracle Express Edition (XE) database. Currently, the last version is 21c, but some others should still be available in Oracle Technology Network's Download section.
3- Does Oracle, is able to handle any kind of dump et restore it in an Oracle DB or is there any constraints to respect ?
XE database has its limits - from your point of view, the most important is that it can handle up to 12GB of user data. Therefore, if the .dmp file doesn't contain more data than that, you should be able to import it.
Another constraint is the compatibility. Not all exports can be imported into all databases. There's a matrix which shows which versions match; it is available on My Oracle Support site (but you have to have access to it, which you - as you said - don't. Though, generally speaking, "close" Oracle database versions can interchange .dmp files. It would be best if these two database versions match, of course.

Oracle DB Export does not preserve order or dependencies

I'm trying to export an Oracle DB using Oracle SQL Developer having tables, sequences, view, packages, etc. with dependencies on each other.
When I use Tools -> Database Export and select all DDL options, unfortunately the exported SQL file does not preserve the other that is some DB objects should be created before some other.
Is there a way to make the DB export utility preserve object dependencies/order? Or Is there any other tool do you use for this task?
Thank you
Normally expdp does a pretty good job. Problems arise when there are dependencies on objects/users that are not part of the dump. This is because the counter part, impdp, does not add grants on objects that are not created by impdp. I call that the 'not created by me syndrome' that impdp has.
If you have no external dependencies (external meaning to schema's that are not part of the dump), expdp/impdp do a good job for you. You might not be able to use it if you can not have access to the database server since expdp writes it's files on the database server.
If you happen to have access to a database server that is able to connect to the original database, you could pull the data over into your local database using a database link.

Is it possible to add an existing tablespace datafile to a new tablespace?

Background: hard-drive died in existing Oracle12cR2 server but I was able to recover all the previous tablespaces from backup, including SYSTEM01.DBF and USERS01.DBF. I created a new Oracle 12cR2 database server, and would like to know if I can recover any of the data in the tablespaces?
Thanks.
if you have oracle running in archive log mode and have a recent backup complete with all archives until the crash: yes you can. After that you can use various methods to move the data to the new database.
My question that remains is: why move it to an other database when you were able to recover the original one? The recovered database is as good as (or even better) than the new one.

Cloning a Oracle Database Schema

I have an Oracle 12c Instance with a scheme 'wadmin' user, this instance has tables, view, data, triggers, sequences etc.
For quick spinning of docker images, I need to clone the db schema as fast as possible , so that I can create another user 'wadmin1' link it to new docker and start my testing.
Any CLI/tools for the same, does oracle provide any options?
I do not know if this is exacly what you are looking for but you can export your Oracle schema using ORACLE DataPump tool. This involves storing exported schema in the Oracle directory. While exporting schema to file you can transform the schema name, omit unnecessary tables or data etc. Exported files with database schema can be later used for imported to new database instance. More information regarding Oracle DataPump you can find here. https://oracle-base.com/articles/10g/oracle-data-pump-10g#SchemaExpImp.
Alternatively you can have scripts that create the database stored in the Git repository and integrate your builds with too called Flyway https://flywaydb.org/ which can be used to automatize of database schema creation. This is also really convenient from source control point of view. All changes on the schema are pull requested.
In my team we use OracleDataPump when we want to recreate the database together with the data, Flyway is used as a part of our continues integration.

oracle express detatach

Hi I am new and I am used to MS SQL Manager's Attach/Detatch functionality to drop a database into a single file so I can move it to other computers/SQL instances. In a nut shell, this is what I want to do.
I have a large Oracle Express database (instance name Zeus) that I need to move onto other Oracle Express instances (brand new installs) and then later I need to keep them updated with Zeus' database.
How do I do this?
I am not understanding how to export the database/schema - user definition/permission, table definitions, and table data.
Thanks guys
I don't believe you can easily do that with Oracle (especially XE edition).
You would usually do an Import/Export. This would give something like :
expdp system/password#XE DUMPFILE=expfull.dmp FULL=y
impdp system/password#XE DUMPFILE=expfull.dmp FULL=y
The expfull.dmp files would be located in a folder named oradata/dpdump in the Oracle XE
installation.
You could also use Transportable Tablespaces as described here and summarized here.
Another method involves 10 steps and would have to be adapted to Oracle XE. I mention it here for reference.

Resources