Schema And Schema Objects

MySQL is a database server that can have several 'databases' each with it's own connection params, privileges, users and objects (tables, views etc). Oracle however has the structure of a 'single database' with 'categorized' objects (if I am correct), that is a database with one or more schemas (usually mapping to users) each containing objects (tables, views etc). If I want to build an application on oracle (I am using Oracle XE) that has several subsystems or modules (HR, Finance, Operations etc) and I want the subsystems to have their own boundaries (like their own database in MySQL, or their own schema in Oracle) containing only relevant objects but interconnected by the usage of the application (the application creates value or functionality across these subsystems), how do I go about structuring my database to handle this, since schemas map to users.
Putt another way, since I'll be working with a user account (a schema) can I have schemas within this account / schema to contain objects for the modules. Wherever the 'module schemas' are, how do I interact with them collectively with my login account which I will use as the database connection within the application.
I don't know if this is the best way to go about it, but my project requirement has changed to one that should have clearly defined modules having similar structures in the database that can be scaled up to their own database in a database server or each in it's own database server.

I did not mention this, but I also already tried that without success. Whether 'DEPARTMENT_VIEW' or 'DEPARTMENTVIEW', I still get 'no data found'. I did not expect to succedd with 'DEPARTMENT_VIEW' just like that, because it is the name of the view in the other schema (HR) hence I made the synomyn 'DEPARTMENTVIEW' pointing to it, which hasn't worked either.
I tried this query :
"SELECT table_name FROM user_tab_columns"
I could see only the tables defined in my schema. This makes me wonder how I can run a query against 'USER_TAB_COLUMNS' for a SYNONYM as the table_name, when 'USER_TAB_COLUMNS' has no entry for any of my SYNONYMS in the first place ??
Based on what Ignacio Ruiz said :
'you need to query ALL_SYNONYMS if you want to resolve DEPARTMENTVIEW'I tried this query :
"SELECT table_owner, table_name FROM ALL_SYNONYMS WHERE synonym_name = 'DEPARTMENTVIEW'"
and got the record, but I don't know how to merge this result to a query on 'USER_TAB_COLUMNS' to get the
column_name, data_type, data_length, data_precision, data_scale, nullable etc for the said 'DEPARTMENTVIEW'.
Please what else can I try. Thanks alot.

Similar Messages

  • Help with exp schema and related objects

    I need to export a schema from one database to another. I must also be able to export the tablespaces, roles, constraints, etc that are associated with it that aren't necessarily part of the schema. Is there an easy way to do this? I had already tried simply doing a schema exp/imp and it threw up a bunch of errors mostly grants which isn't that big of a deal but some of the tables were not created due to tablespaces being missing.

    exp system/manager file=exp.dmp log=exp.log full=y at the source database.
    imp system/manager file=exp.dmp log=imp_show.log full=y show=y - create the log file without importing the data
    edit the imp_show.log and extract the statements that are needed to re-create users,roles,alter user and grants.
    Pre-create the tablespaces using SQL*Plus in the target database.
    execute the modified imp_show.log(All DDl's)
    imp system/manager file=exp.dmp log=imp.log fromuser=A touser=B
    Re-compile all the Invalid Objects.
    HTH
    -Anantha

  • Dropping schema and associated objects

    I have just had a request to drop a particular schema with the associated objects...how do i go about it

    Hi,
    Its simple, use the follow sintaxe:
    DROP USER <schema> CASCADE;
    I hope help you!
    Jonathan Ferreira - Brazil
    http://www.ebs11i.com.br

  • Difference Between Database Schema and Database User Account ??

    First i would like to know what an Oracle Database schema exactly is ?
    And what is it for and also What is it's use ?
    Later the exact "Difference Between Database Schema and Database User Account".
    I googled about it but i'm unable to find out it's The difference,
    Please try to explain in a simple manner........
    Thank you very Much in Advance..........

    user13655582 wrote:
    Greate example. but i would like add one more point..
    a user is a schema and schema is a user. but when this applies to the user that he become a schema, only if he has got some objects. so we can say while creating the user which dosent contain any objects called simple user account but afterwords when he has got an objects then we can say its a schema as the above user has shown you through the exampleIt is just word-play. There is nothing in like a 'status' indicator to say "USER_A is just a user but USER_B has become a schema". Many people use the terms "user" and "schema" interchangeably, and some very good DBAs will insist this is correct. I don't disagree with them even though I usually try to make the distinction.
    In a typical application, all of the objects (tables, procedures, etc) that implement the app will be owned by a "application schema owner" - a user which exists for the sole purpose of owning the schema. Said user will have no privileges at all .. especially not CREATE SESSION. Except for possible maintenance activity no one ever actually connects as this user. User accounts are then given to actual humans who connect with their own accounts. The accounts have the necessary system and object privileges granted to them - via a role. One could also create a special account (let's call it APP_ADMIN) that is used for maintenance and batch operations within the application.

  • Oracle and business object!

    hi!
    we have oracle 10g on rhel4.
    we do have business object XI
    even if i have restricted the permissions for the users, why do i see all the schemas and there objects like CTXSYSM, DBSNMP, SYS when i connect throught the universe of BUSINESS OBJECT XI.
    may be it is because by default all users have the privileges which the pseudo role PUBLIC has and when we install oracle, there are so many privileges like insert, update,delete, select on many objects in the schemas which are given to public by default.
    can i seperate a user from the public privileges?
    kind of ... revoking public (role) from the user???
    thanks

    since public pseudo role has a lot of privileges (select, insert, execute, delete) on many of the objects in CTXSYS, SYS, DBSNMP schemas. Also a user can run a select on ALL_ and USER_ tables and views from the dictionary.
    can i restrict a user to view the ALL_ and the USER_ views from the dictionary and should see only the objects which i give explicit priviliges.
    also can i revoke the privileges which are defaultly given to PUBLIC from a user???
    (all users have the privileges which are there with PUBLIC, and defaultly PUBLIC has a lot of privileges at database creation time)
    please help me to resolve the security threat!
    thanks

  • How to identify and delete objects after failure of registering XML schema

    Hi,
    I have tried to register a XML schema with many global elements but failed.
    I have checked the view DBA_XML_SCHEMA and found that there is an entry for this failed XML schema and the disk spaces would not be freed after the failure of registration as well.
    I have tried DBMS_XMLSCHEMA.deleteSchema() with DELETE_CASCADE_FORCE but failed with ORA-31000: Resource is not XDB document.
    How can I identify and delete the objects for this failed XML schema and free up the disk space ?
    I would not prefer to use 'DROP USER ... CASCADE' since there are other objects owned by this user.
    Thanks in advance.

    you can get them from user_objects.
    but you have to identify them manuallly if your schema has other objects other then created by the xml schema creation process.
    Note these objects will be cases senistitive. so you should enclose them with double quotes during deletion.

  • How can I export schema with all objects and few tables without data

    Hi all
    Verion 10g EE.
    I have to export schema with all objects but i need to ingnore some of the table data.
    There are 4 table those have huge data, we need not to export those tables data but structure should export.
    Thanks,
    Nr

    You can do this with a single command.  Run your export as normal and add query parameters for the 4 tables that you don't want any rows:
    expdp ...  query=schema1.table1:"where rownum = 0" query=schema2.table2:"where rownum = 0" ...
    It is best to put the query parameters in a parameter file so you don't have to worry about escaping any OS special characters.
    Dean

  • Context,Physical schema and Logical schema

    Hi,
    How the context,physical schema,logical schema and agent are interrelated.
    Please explain
    Thanks
    Jack

    Hi Jack,
    Context:
    A context is a set of resources allowing the operation or simulation of one or more data processing applications. Contexts allow the same jobs (Reverse, Data Quality Control, Package, etc) to be executed on different databases and/or schemas.
    Its used to run the object(process) in different database.
    Physical Schema:
    The physical schema is a decomposition of the data server, allowing the Datastores (tables, files, etc) to be classified. Objects stored in data servers with this mode of classification can be accessed by specifying the name of the schema attached to the object name.
    Ex
    Oracle classifies its tables by "schema" (or User). Each table is linked to a schema, thus SCOTT.EMP represents the table EMP in the schema SCOTT.
    Logical schema:
    A logical schema is an alias that allows a unique name to be given to all the physical schemas containing the same datastore structures.
    ->The aim of the logical schema is to ensure the portability of the procedures and models on the different physical schemas. In this way, all developments in ODI Designer are carried out exclusively on logical schemas.
    Thanks
    Madha

  • Oracle APPS schema copy with all privileges to new schema and table space

    Hi all,
    Here is scenario:
    I have installed e-business suite in windows 2003 server for training environment using production (prod), single node and without vision (demo).
    i have to create a new table space in e:\oracle\prodmanz with similar content as in proddata and create a new schema called manz with same privileges as APPS.
    Kindly advice.
    Manish Kumar Chudasama
    email: [email protected] cc to [email protected]
    Thanks in advance guys.

    Hi Khalid,
    Ideally when you execute sql 'create schema <schema_name>' then the logged in user is going to default owner of the schema and you should see that under 'object privileges' of that user.
    The user will have 'create any' privileges which means the user has all the privileges on that schema.
    if you want to check who is owner of the schema in the system, please check 'SCHEMAS' under views in SYS.
    Regards,
    Venkat N.

  • Altering schema of tables/objects inside a crystal report through API

    hi all,
            We run crystal reports through a Java application (using CR4E API) connecting to Oracle database. All the tables/views within the report do not use fully qualified names (i.e. schemaName.objectName) instead they use the object name alone. Earlier we would run all the reports logging in as the schema owner and hence all the objects would be accessible without issue. Per a new requirement we now log in as a non-schema owner ID and the objects are now not accessible to this user id unless a fully qualified object is not provided as the default context schema will now be different.
           We tried altering the schema through the API like so,
            ITable origTable = null;
            ITable newTable = null;
            String DB_USER_NAME = username;
            String DB_PASSWORD = password;
            String TRUSTED_CONNECTION = "true";
            String SERVER_TYPE = "JDBC (JNDI)";
            String USE_JDBC = "true";
            String DATABASE_DLL = "crdb_jdbc.dll";
            String JNDI_DATASOURCE_NAME = jndiName;
            String CONNECTION_URL = connectionURL;
            String DATABASE_CLASS_NAME = driverName;
    Tables tables = clientDoc.getDatabaseController().getDatabase().getTables();
                for(int i = 0;i < tables.size();i++){
                    origTable = tables.getTable(i);
                    if (tableName == null || origTable.getName().equals(tableName)) {
                        newTable = (ITable)origTable.clone(true);
                    newTable.setQualifiedName("TestSchema." + origTable.getAlias());    <--- Set actual schema here but it still takes the alias as "command"
    Are we doing anything wrong here? It appears that the table name is always "command", internally I think CR uses the name command for its table and we are not allowed to change it. The table name, alias and qualifier name are be default set to "command" by CR. If I append schema name to the table name I get schemaName.command as against schemaName.objectName.
    Synyonyms are not an option for us for various reasons. We will not be able to go down that road no matter what. However we are looking at an API related solution here so if anyone could advise in this regard it would be very helpful.

    Lindell - your response was very helpful.  I was able to create a SQL Command on the subreport and change the subreport links on the main report to use the paramters in the SQL Command.  The report is now very fast - even when there are lots of detail records on the main report.  It is properly executing the query and not reading all 2M records into memory for each subreport.
    I'm still totally confused as to why Crystal was misbehaving so poorly and changing how the subreport queried the database when the only change was the fields used for record selection on the main report.  It really looks like a bug to me, but maybe someone can still enlighten me.
    thanks again so much.  We are in Parallel testing for a production rollout - and the users are MUCH happier now!  (which of course makes me much happier!)
    Susan
    PS I was not aware of the SQL Command - had never used it before.  Took me a little while to figure it out and how to do the linking - but it is very powerful.  Thanks again.

  • Compare 2 schemas and get the difference with .sql file.

    Hi,
    I am using ORACLE DATABASE 11g R2 and ORACLE Linux 5.
    I want to perform a very lengthy process and want to make it automated.
    I am having a software named as SVN. In which all the developers keep their updated scripts.
    We have 2 schema's one is used for developement and when all the development seems good we implement the scripts on the final schema which is used by testing people also.
    Now every day we need to check the modifications in the development schema, that we do by observing the updated scripts in the SVN software. Now we get the scripts which are modified.
    We will fire this scripts to a sample schema then we will compare the objects in this schema and the same objects in our final schema. If the objects in sample schema is different than the final schema it should give me the
    script to create the same type object in the final schema.
    Below is a proper example to explain :-
    Developement Schema :- 'DEV'
    SVN Script Schema :- 'SVNscript'
    Main Schema :- 'MAIN'
    1) On Monday developers modified/added 4 tables in the development schema names 'DEV' after working for a day they found that the changes are necessary and so checked-in in the SVN software.
    2) On tuesday morning we found 4 scripts which has been modified/added in the SVN.
    The Scripts were as follows :-
    1St table :- An extra column was added.
    2nd table :- An index was created on it.
    3rd table :- 2 Columns were dropped from it.
    4th table :- A new table is added in the schema.
    Now taking these 4 scripts i am going to execute it in a sample schema named :- SVNscript
    SVNscript schema will have now 4 tables with proper properties(columns,indexes,...). Now this is the final table structure as we want in our 'MAIN' schema .
    Coming to MAIN schema which is our most important schema and all the development work is finally posted here.Considering MAIN schema is having around 1000 tables,500 function/procedure/package and many more DB objects.
    I want to compare(one way compare) from SVNscript schema --> MAIN schema :- That the objects present in the SVNscripts schema is same or not in the MAIN schema. If its not same then this code should generate a .sql script for me which i should be able to fire on the MAIN schema.
    The output .sql scripts should be something like this :-
    1st Table :- Alter table add...
    2nd Table :- Create index on table...
    3rd Table :- Alter table drop...
    4th table :- Create table tablename...
    I found a link while trying this but it is not the perfect fit to my requirement
    http://www.dbspecialists.com/files/scripts/compare_schemas.sql
    Please let me know the best code to compare 2 schemas and get a .sql file as output of the difference.
    Thanks in advance.

    Yes I followed the tutorial properly this time. Still i have a few queries :-
    1) This is returning me the 'ALTER TABLE...' statement but how to make it more efficient to return all the DDL dependent on the table, Like index,trigger,view...
    2) I want to compare objects in a different schema on a different db. I have created an DBLINK but how to use it ... can i use it like
    DBMS_METADATA.OPEN('TABLE'," Network_link_name " );Can you please give me some clear about it.
    3) I created a table 'TAB1' with which i want to compare a 'TAB1' in other schema.I was not getting how to compare on remote dblink so,I created the same table with the following code in the same schema
    CREATE TABLE TAB1_OLD as select * from TAB1@DBLINK where 1=2;Now when i fire the below query to get the alter difference I get the following error :-
    SQL> SELECT get_table_alterddl('TAB1','TAB1_old') FROM dual;
    SELECT get_table_alterddl('TAB1','TAB1_old') FROM dual
    ORA-31603: object "TAB1_old" of type TABLE not found in schema "SVNCHECK"
    ORA-06512: at "SYS.DBMS_METADATA", line 5225
    ORA-06512: at "SYS.DBMS_METADATA", line 5189
    ORA-06512: at "SVNCHECK.GET_TABLE_SXML", line 17
    ORA-06512: at "SVNCHECK.COMPARE_TABLE_SXML", line 12
    ORA-06512: at "SVNCHECK.GET_TABLE_ALTERXML", line 11
    ORA-06512: at "SVNCHECK.GET_TABLE_ALTERDDL", line 11
    Can you please guide me why i am getting this error?
    I have made sure that TAB1_OLD table has been created and the entries are also present in the data dictionary tables.
    SQL> select * from tab1_old;
    EMPNO ENAME                  MGR DEPTNO
    ----- -------------------- ----- ------The only difference is that this table was created with CREATE TABLE AS SELECT statement ....
    Thanks.

  • How to know database name and schema name by providing package name?

    Hi,
    Could someonw will help me to get database name and schema name by providing package name ?
    I have used the query : select * from all_objects where object_name='Package_name'; but it simply returns schema name where as i need DB name and username.
    --Prajakta

    but it simply returns schema name where as i need DB name and username.
    i want to retrive the DB name for package name
    Based on your questions, I wonder if you are used to working in SQL Server? (The server, database, and schema are part of the 4-part  name of an object, independent of any user.)
    In SQL Server, schema and username are two separate physical concepts.  "Schema" is purely logical in Oracle: a user which owns objects is often called a "schema".
    In Oracle, "database" is roughly equivalent to the SQL Server concept  "server" (what you log in to).  It is not part of the naming path to a specific object  (unless there is a database link involved, but there is no indication that's what you have here).  In Oracle you connect to an Instance (or Service) and people often call this the "database", but there is a fine semantic distinction there (separate topic). 
    Once connected in Oracle, you fully-qualify an object by only a 2-part owner and object name (possibly 3-part if a database link is involved user.object@link).
    12c added another wrinkle to all of this, but I'll assume this question was more basic than that, because you likely would have mentioned if this was a 12c question.

  • How to export app +underlying schema(and data)

    Hi
    I am trying to export my application and its underlying tables to a new system .
    I want to know if it can be done together and not seperately..(export app and then export each table)
    Is there away to package the app and its underlying repository?
    Thanks

    No....
    You will have to do them seperately as there is no logical connection between the application and the tables.
    Your application just has the access to use those tables and does not "own" any of them.
    a) Oracle database tables/ application tables
    You can export the entire schema and all the objects and data in that schema using the export and import utilities.
    All these objects are owned by the schema (eg. emp under scott) and hence are related logically.
    b) Oracle apex metadata tables.
    All the information about apex objects is stored as metadata in database tables (FLOWS_0300 is a schema).
    So, if you install Oracle apex on a new machine, all these repository tables will be created.
    When you create applications / objects, these tables will have metadata for those applications.
    Hope this helps,
    Rajesh.

  • Extend AD Schema and configure Logon Manager

    Hi,
    i tried to extend schema and configure the logon manager but with no success.
    When i extend schema in ESSO Admin Console a successful message appear, but when i check the Active Directory for the objects that should appear, non of them are in there.
    Can someone please explain me what im doing wrong, or give me a link where the steps to extend and configure logon manager are explained?
    thanks

    I,
    thanks for the answer.
    now the AD is extended successfully.
    But i have one more problem, in the agent installed in the server machine de apps appear correctly and the users are synchronized correctly, although in other machine that the agent is installed i cant connect to AD (i think) the apps not appear..
    When the window "Connect to Active Diretory" of the agent appear i introduce de credentials : Administrator and pass of the AD administrator. Am i right?
    I think theres a problem with the connection with the AD and the machine.
    Thanks..

  • Multiple Instances and schemas to One

    Hi,
      Good Morning to all gurus.
    Using Oracle Version 11.2.0.2
    We have a database With 4 instances and Each Instance will be having 10 to 15 schemas Based on Countries. Here in all schemas we will be having Huge data's (count may be 3 to 5 crores for some 10 tables)
    Now am keen to Know If i change the above to a single instance and Single Schema(Common for all countries) What Pros and cons Will be there (Technical).
    Any Links or Answers are highly appreciated.
    HOPE GURUS Here can help me study and understand the above scenarios.
    Regards,
    Simma....

    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2246908001297
    cons: 
    o harder to manage
    o harder to upgrade
    o harder to patch
    o harder to maintain
    o causes your shared pool size to increase 1,000 times (shared sql goes down the tubes)
    o takes more space
    o queries against the dictionary will be impacted
    o latching on the shared pool goes WAY up (latching = locks = serialization device =
    slows you down)
    pros:
    o none that I can think of.
    https://forums.oracle.com/thread/1032030
    Seperate schemas have advantages with security, privacy, seperation of duties, and change control. Seperate schemas also have the advantage of logical granularity / grouping for easier management, upgrade, decommission, scalability, hardware or software migration.
    Yes, you can develop applications faster if you don't have to think about security, scalability etc, but it will come back to haunt you later.
    RobertGeier
    AND
    Separate schemas have the disadvantage of requiring additonal grants and privileges to support the reference of non-owned objects used in stored code and to support FK definitions across tables owned by different users.
    Naming standards and system codes can be used to identify and segregate objects defined under one schema.
    The use of solid naming standards with a well chosen group of owners (schemas) would likely be a good compromise. The choice really depends on how large the applicaiton is going to be object wise and how integrated the objects are going to be. The more integration the less separate owners is beneficial.
    IMHO -- Mark D Powell --

Maybe you are looking for