dropping objects in oracle database 12c without generating archivelogs - oracle

is there any way to drop objects and packages of a schema in ORACLE DB without generating archive logs?
i have a huge schema that is decommissioned. i want to drop all its objects first but it generates a lot amount of archive logs which filled my Fast Recovery Area.
please help if you know any solution to the objects of a schema without generation of archive logs.
i tried to use drop for example:
drop package xyz it generated a lot of archive logs.
note:
the database server is holding both active and non active schemas all what i need is to drop the old non active schemas without generating archive logs.
Thank you in advance,
Wissam.

If the system is really going to be decommissioned then you can alter the system and set off archive mode at first place and then start dropping the objects.
The method for disabling archive log mode is:
Shutdown edit pfile / spfile (spfile when instance is up ofcourse) to say log_archive_start = false.
startup mount
alter database noarchivelog;
alter database open;
Read more at here.

Related

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.

Creating a DDL for a baseline for flyway

I've got an oracle 11 XE database, with 3 schemas in it, that I want to create a DDL file for to make a baseline script to use with flyway.
I've tried to export just the DDL of all 3 schemas, but the resulting sql doesn't include the creation of the users, or the creation of the tablespaces. It just starts off with sql to create tables, which will not work as the users or the tablespaces don't exist.
Is there any way to do this with sql-developer or am I using the wrong tool for the job here?
I'm thinking I may need to include all the SYSTEM objects in the DDL, but no idea how importing that into a running oracle instance will work.
Any tips or hints I'd be grateful for, I'm starting to think this plan just isn't possible. :-(
Thanks
Matt
when we generate the ddl for a schema, we grab the schema objects, not the definition of the user that owns the schema, nor the tablespaces used IN the schema
you can still get those though, just open the DBA Panel -

Oracle rman simple backup on 11g

This question is almost exaclty like
oracle rman simple backup
but there isn't an acceptable answer there, and this question is about 11g. So I'll ask:
I'd like to do some table initialization DDL tests on an oracle shema, and I'd like to revert the database to the prior-test state between runs. I'm executing the following in RMAN:
shutdown immediate;
startup mount
backup database;
sql 'alter database open';
As I see it works fine, list backup shows backups.
Than I made some modifications (Added some users, added some tables, adding data) and I tried to restore backup:
shutdown immediate;
startup mount
restore database;
recover database;
sql 'alter database open resetlogs';
Expected result: the database should be restored to the exact state as to when the initial backup was taken.
Actual result: all the new tables and users I created in my test DDL continue to exist. I verified this by closing connections, restarting sessions, and then even selecting from the tables! The tables still exist even after the restore!
What is the deal with this? In MSSQL and Postgres, a backup means you save the state of the db, and restoring it means you go back to when the backup was. But in RMAN for oracle 11g, it 'claims' the restore was successful, but the evidence clearly shows otherwise.
How can I get oracle to save the state of the database exactly as it is, and then make changes, and when I restore, i want the database to be exactly as it was when I backed it up?
Is this possible in Oracle?
Yes it is possible - you have several options:
create a cold backup of the database (datafiles, controlfiles, online redo logs) and then to restore them when it is necessary
Perform so called "point in time recovery" (assuming your DB is in archivelog mode). Take DB backup with RMAN note the "time" or "SCN" or "archivelog sequence" after a while you can restore DB and recover until previous noted time/SCN/LOG SEQUENCE
Special designed by Oracle for this purposes and I recommend it in your case "Flashback Database" (brows Oracle docs to see what this is).
Oracle always "try" to restore/recover your database up to last committed transaction if it is possible, that is why you get the result you described above, but if you want to restore up to specific time/SCN/SEQUENCE just tell Oracle about this :)

oracle database cloning

i tried to clone one of my database in one machine to another machine.
the procedure is right i guess its getting mounted but am unable to go to open state.its showing errors as below.
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
would anyone suggest me what the exact pblm is?
Thanks in advance!
perhaps this might help you:
Cause of your problem:
Some datafiles are offline.
ORACLE instance terminated. Disconnection forced so this might cause the datafiles to be offlined
Solution:
Check if you have a good backup from which you can restore any problematic data file.
1) first restore the problematic datafile.
2) mount the database
SQL > recover database;
And then try to open the database
SQL > alter database open ;
3) Try to find if there are any offline files by checking the recover_file.
SQL> select * from v$recover_file;
For example:-
11 OFFLINE OFFLINE
2489793132
30-JAN-09
20 OFFLINE OFFLINE
2489793132
4) Recover the offline datafiles that were appearing from above select statement,
i.e.
SQL> recover datafile 11,20;
Media recovery complete.
5) Bring these datafiles back online,
i.e
SQL> alter database datafile 11,20 online;
Database altered.
6) To ensure no more files just check again the recover_file view, then you can safely open the database
SQL> select * from v$recover_file;
no rows selected
Hope this helps.
Did you also clone your Oracle home?
If yes, make sure your update your pfile/spfile with your new server name.
Also, don't forget listener.ora.
Hope this helps.

How to duplicate an Oracle instance?

How can I duplicate an Oracle instance? Does anyone have any idea how to do so?
Assuming you want the schema and data duplicated, use the exp and imp commands to export your database, then import it as another user using the FROMUSER and TOUSER parameters.
Well, presumably you have a backup (surely!), so just test your backup recovery on your test server.
To be slightly more serious, it depends what version you are using, newer versions of RMAN make it pretty easy I believe, older versions, you basically do it as a backup recover.
How I've done it in the past, is basically
copy backup data files
create init file
create a new controlfile is the command 'CREATE CONTROLFILE SET DATABASE "TEST" RESETLOGS ARCHIVELOG'
Apply archivelogs and then open with resetlogs
Here is an article which explains the process with a bit more detail
A minor comment on your terminology - "instance" is actually the set of processes running on the database server host and you want to duplicate the "database".
As someone else mentioned, the best way is to start with an RMAN backup of the original database. However, since Oracle 9 RMAN has had the "DUPLICATE DATABASE" command, which takes care of a lot of housekeeping that used to be necessary if you just made a copy by restoring a production backup (e.g. resetting DBID, changing data and log file locations in the control file, setting database GLOBAL_NAME, etc.).
If you're not using RMAN, and the database is on the small side, you can script something that puts each tablespace in hot backup mode, copies the datafiles for that tablespace to a backup location, and then takes the tablespace out of hot backup mode. You now have a recoverable backup that can be moved to another host for archive log application. This definitely has a performance impact on the original database and should be your last resort.
Create a template based on your existing instance. You can then create other instances.

Resources