Home » RDBMS Server » Server Administration » Deleting unwanted SYS shema objects (Oracle 11.2.0.1.0, Windows 2008 R2)
Deleting unwanted SYS shema objects [message #509028] Wed, 25 May 2011 11:31 Go to next message
geobraik
Messages: 34
Registered: April 2011
Member
Hi,
I was importing one schema from Oracle 10g to 11g using traditional import. I imported as a SYS user, so all the objects created in SYS schema. Can you please tell me how can I remove these objects and retain only default SYS objects

Thanks in advance
Geobraik
Re: Deleting unwanted SYS shema objects [message #509032 is a reply to message #509028] Wed, 25 May 2011 11:49 Go to previous messageGo to next message
Michel Cadot
Messages: 68648
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I don't think you import SYS as SYS is not in export file.

Copy and paste what you did and got (in text mode no image).

Before, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.

Regards
Michel
Re: Deleting unwanted SYS shema objects [message #509033 is a reply to message #509032] Wed, 25 May 2011 12:08 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
Importing non-SYS objects into the SYS schema definitely works:
c:\users\john\home>imp 'sys/oracle as sysdba' file=dept.dmp full=yes

Import: Release 11.2.0.2.0 - Production on Wed May 25 18:02:33 2011

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 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Export file created by EXPORT:V11.02.00 via conventional path

Warning: the objects were exported by SCOTT, not by you

import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
. importing SCOTT's objects into SYS
. importing SCOTT's objects into SYS
. . importing table                         "DEPT"          4 rows imported
Import terminated successfully without warnings.

c:\users\john\home>

Perhaps you can identify the imported objects with a query such as this:
select object_name from all_objects where owner='SYS' and last_ddl_time > sysdate -60/1440;
if you know approximately when the import ran?

Re: Deleting unwanted SYS shema objects [message #509039 is a reply to message #509033] Wed, 25 May 2011 13:08 Go to previous messageGo to next message
geobraik
Messages: 34
Registered: April 2011
Member
Thank you very much for the reply
When imported a dumpfile having two schemas there was no issues. Objects got imported to respective schemas.
But when I imported dumpfile having only one schema it created objects in SYS schema.
Both time I used the same parameters for importing.
imp file=test.dmp compile=y grants=n log=log.log
username: / as sysdba

I want to import two more schemas, which is in a single dump file (exp). Please tell me the best way to import.
Re: Deleting unwanted SYS shema objects [message #509047 is a reply to message #509039] Wed, 25 May 2011 13:34 Go to previous messageGo to next message
Michel Cadot
Messages: 68648
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
- Never ever use SYS (or SYSDBA) but for maintenance purpose (startup, shutdown, backup, recover)
- SYS/SYSDBA is special
- SYS/SYSDBA is Oracle proprietary (try to open a SR/TAR starting with "i did that with SYS/SYSDBA" and you'll see the immediate answer)
- SYS/SYSDBA does not act like any other user
- When you use SYS/SYSDBA Oracle deactivates some code path and activates others
- Whatever you do with SYS/SYSDBA will neither validate nor invalidate the same thing with any other user.

NEVER EVER use SYS/SYSDBA for anything that can be done by another user.
Use SYS/SYSDBA ONLY for something that can't be done by someone else.


Quote:
I want to import two more schemas, which is in a single dump file (exp). Please tell me the best way to import.

C:\>imp help=y

Import: Release 10.2.0.4.0 - Production on Mer. Mai 25 20:33:51 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.



You can let Import prompt you for parameters by entering the IMP
command followed by your username/password:

     Example: IMP SCOTT/TIGER

Or, you can control how Import runs by entering the IMP command followed
by various arguments. To specify parameters, you use keywords:

     Format:  IMP KEYWORD=value or KEYWORD=(value1,value2,...,valueN)
     Example: IMP SCOTT/TIGER IGNORE=Y TABLES=(EMP,DEPT) FULL=N
               or TABLES=(T1:P1,T1:P2), if T1 is partitioned table

USERID must be the first parameter on the command line.

Keyword  Description (Default)       Keyword      Description (Default)
--------------------------------------------------------------------------
USERID   username/password           FULL         import entire file (N)
BUFFER   size of data buffer         FROMUSER     list of owner usernames
FILE     input files (EXPDAT.DMP)    TOUSER       list of usernames
SHOW     just list file contents (N) TABLES       list of table names
IGNORE   ignore create errors (N)    RECORDLENGTH length of IO record
GRANTS   import grants (Y)           INCTYPE      incremental import type
INDEXES  import indexes (Y)          COMMIT       commit array insert (N)
ROWS     import data rows (Y)        PARFILE      parameter filename
LOG      log file of screen output   CONSTRAINTS  import constraints (Y)
DESTROY                overwrite tablespace data file (N)
INDEXFILE              write table/index info to specified file
SKIP_UNUSABLE_INDEXES  skip maintenance of unusable indexes (N)
FEEDBACK               display progress every x rows(0)
TOID_NOVALIDATE        skip validation of specified type ids
FILESIZE               maximum size of each dump file
STATISTICS             import precomputed statistics (always)
RESUMABLE              suspend when a space related error is encountered(N)
RESUMABLE_NAME         text string used to identify resumable statement
RESUMABLE_TIMEOUT      wait time for RESUMABLE
COMPILE                compile procedures, packages, and functions (Y)
STREAMS_CONFIGURATION  import streams general metadata (Y)
STREAMS_INSTANTIATION  import streams instantiation metadata (N)
DATA_ONLY              import only data (N)

The following keywords only apply to transportable tablespaces
TRANSPORT_TABLESPACE import transportable tablespace metadata (N)
TABLESPACES tablespaces to be transported into database
DATAFILES datafiles to be transported into database
TTS_OWNERS users that own data in the transportable tablespace set

Import terminated successfully without warnings.

See FROMUSER/TOUSER and do it in 2 passes.

Regards
Michel
Re: Deleting unwanted SYS shema objects [message #509059 is a reply to message #509047] Wed, 25 May 2011 14:26 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
With V11 you should be using expdp & impdp; not deprecated utilities exp & imp.
Re: Deleting unwanted SYS shema objects [message #509108 is a reply to message #509059] Thu, 26 May 2011 03:07 Go to previous messageGo to next message
geobraik
Messages: 34
Registered: April 2011
Member
Yes. I know that. But the export dump I have is created using exp only.

I need one more clarification.
When I queried
select count(*) from all_objects where owner='GEO';
results obtained are Source DB : 851 TargetDB : 699
select count(*) from dba_objects where owner='GEO';
also shows the same result.

Why this difference? Is anything wrong with the import?
Please help me

Thanks in advance
Geobraik
Re: Deleting unwanted SYS shema objects [message #509114 is a reply to message #509108] Thu, 26 May 2011 03:16 Go to previous messageGo to next message
Michel Cadot
Messages: 68648
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
also shows the same result

Quote:
Why this difference?

If it is same I don't see any difference.

Regards
Michel
Re: Deleting unwanted SYS shema objects [message #509120 is a reply to message #509114] Thu, 26 May 2011 03:28 Go to previous messageGo to next message
Roachcoach
Messages: 1576
Registered: May 2010
Location: UK
Senior Member
Michel Cadot wrote on Thu, 26 May 2011 09:16
Quote:
also shows the same result

Quote:
Why this difference?

If it is same I don't see any difference.

Regards
Michel


I didnt either at first but I think he refers to this line hidden between tags:

Quote:
results obtained are Source DB : 851 TargetDB : 699



The "same results" seems to refer to the queries against ALL_ and DBA_ views.

[Updated on: Thu, 26 May 2011 03:29]

Report message to a moderator

Re: Deleting unwanted SYS shema objects [message #509123 is a reply to message #509120] Thu, 26 May 2011 03:45 Go to previous messageGo to next message
Michel Cadot
Messages: 68648
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Wooo! good eyes!

@geobraik
So the answer to "Is anything wrong with the import?", is maybe but you are the only to have the log.
Or maybe the error is on the export, see its log.

Regards
Michel
Re: Deleting unwanted SYS shema objects [message #509135 is a reply to message #509123] Thu, 26 May 2011 04:23 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
I see that you are using 11.2, deferred_segment_creation can give you this effect: the export won't include tables that have no segment.
Re: Deleting unwanted SYS shema objects [message #509137 is a reply to message #509123] Thu, 26 May 2011 04:33 Go to previous message
geobraik
Messages: 34
Registered: April 2011
Member
This is the import log of another schema (deleted the middle part. There was no errors)

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Export file created by EXPORT:V10.01.00 via conventional path
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
import server uses AR8MSWIN1256 character set (possible charset conversion)
export client uses AR8MSWIN1256 character set (possible charset conversion)
. . importing table              "xxxxxx"          1 rows imported

....................................................................
..................................................................
About to enable constraints...
Import terminated successfully without warnings.



The above mentioned quries returned 208 for source and 126 for source;
select count(*) from tab
gives only 77 in both soure and destination.

The import parameters used are
imp beda/*** file=beda.dmp log=beda.log grants=n compile=y fromuser=beda touser=beda

[Updated on: Thu, 26 May 2011 05:14]

Report message to a moderator

Previous Topic: Installation of 11gR2 on Windows
Next Topic: Errors while starting the DB using SPfile
Goto Forum:
  


Current Time: Wed May 08 00:36:43 CDT 2024