Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 62 Insurance
- 536K On-Premises Infrastructure
- 138.2K Analytics Software
- 38.6K Application Development Software
- 5.7K Cloud Platform
- 109.4K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71.1K Infrastructure Software
- 105.2K Integration
- 41.5K Security Software
Need a command to rename a schema

Ask Tom has -https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:30020192108317
|
Oracle needs a command like
RENAME SCHEMA <schema name> TO <new schema name>
the one step command needs to cleanup all the warning identified by AskTom
Comments
-
Great Idea, although I imagine it is much easier said than done.
-
I've needed this so many times.....
You'd think most of this would be achieved by just updating user$ - surely all the other dictionary objects are referencing the user by id not name?
Surely only hardcoded schema references in stored plsql are going to be the real headache?
-
I've needed to do this so often that I even wrote an article about this topic.The workaround that I use is to "clone" the user to the same DB with a different name, using loopback dblink. It's very fast and in the end, after a successful checkup, you can drop the old schema.
The article is in here: http://www.dbarj.com.br/en/2014/11/rename-schema-oracle-11g-loopback-dblink/
Regards,
-
I've needed to do this so often that I even wrote an article about this topic.The workaround that I use is to "clone" the user to the same DB with a different name, using loopback dblink. It's very fast and in the end, after a successful checkup, you can drop the old schema.
The article is in here: http://www.dbarj.com.br/en/2014/11/rename-schema-oracle-11g-loopback-dblink/
Regards,
Hi,
I've done that myself - when the database gets big though it becomes impractical. I then came up with another approach using TTS Oracle DBA Blog 2.0: How to rename a 500GB schema in 17 minutes.....
However i still think a rename schema is much simpler and less hassle.
Both of the methods above still need you to update hardcoded references in plsql, so i don;t see how a rename schema is really any different - that manual bits are still required - as long as this is clear in the documentation then i think this is (if the data dictionary was designed relationally.....) a simple case of:
update user$ set name='newname' where name='oldname'
However there must be more to it than that otherwise it would already have been implemented long ago.
This is still the best idea on the list (so far).
Regards,
Rich
-
We, Oracle are working on our internal process as to how to evaluate and prioritize the IDEAS submitted. But the more votes obviously the more priority we will put on the request. However votes/popularity alone will not determine the priority.
As we move through the process the IDEA will change stages: (not in flow order)
- Active
- Already Offered
- Archived
- Coming Soon
- For Future Consideration
- in Progress
- Partially Implemented
- Under Review
-
Hi,
There is an undocumented feature to create schema synonyms: http://www.dbi-services.com/index.php/blog/entry/create-schema-synonym-in-oracle-unsupported-feature
The rename schema should be much easier to implement (just update the sys.user$ and invalidate all dependencies)
Regards,
Franck.
-
The best alternative I've seen is from @P.Forstmann: https://pierreforstmanndotcom.wordpress.com/2015/02/27/how-to-rename-an-oracle-schema-without-exporting-and-importing-al…
-
In principle it should be as simple as an update of the "label" in column "name" on SYS.USER$...but that would assume that only user# is used as a reference and, eg. passwords, don't have dependency with "name" values...
SELECT user#,
name
FROM sys.user$
WHERE type# = 1
ORDER BY user#;
0 SYS
7 AUDSYS
8 SYSTEM
13 OUTLN
21 GSMADMIN_INTERNAL
22 GSMUSER
23 DIP
36 ORACLE_OCM
48 DBSNMP
49 APPQOSSYS
50 XDB
51 ANONYMOUS
61 GSMCATUSER
62 WMSYS
70 OJVMSYS
73 CTXSYS
75 ORDSYS
76 ORDDATA
77 ORDPLUGINS
78 SI_INFORMTN_SCHEMA
79 MDSYS
82 OLAPSYS
85 MDDATA
87 SPATIAL_WFS_ADMIN_USR
90 SPATIAL_CSW_ADMIN_USR
92 LBACSYS
99 DVF
102 HR
104 IX
105 SH
106 PM
107 BI
109 OE
110 SCOTT
-
Another alternative would be Goldegate or streams - replicate to another schema if it's required online, and then cutover when needs be?
Streams can be tricky but once setup it's great / depending on the level of change. If doubles the footprint but if you can beg or borrow the storage
The lack of functionality might reflect making sure some pre planning goes into it, I support in another world you could have a push to change naming conventions left, right and centre.
-
I've needed this so many times.....
You'd think most of this would be achieved by just updating user$ - surely all the other dictionary objects are referencing the user by id not name?
Surely only hardcoded schema references in stored plsql are going to be the real headache?
Exactly - and what about the hardcoding in the dynamic PL/SQL. There isn't a dependency like static PL/SQL.
How will a rename command change these references?
I can just see a junior DBA using the rename command, then logging a SR complaining that the dynamic PL/SQL didn't update......