Exporting views from a schema
Hi Gurus,
We have a problem while creating a replica of a remote DB in local.
We were able to export all DB objects except views.
As they are critical for making the local DB 'complete', we are looking for a solution.
We have tried the below query for getting the definition for a single view on a schema, but the query is taking too much time, even if run on the server.
Select dbms_metadata.get_ddl('VIEW','<VIEW NAME>') from dual
Please suggeest us a solution for the same.
NOTE: Unfortunately we don't have any advanced tools and we are just relying on the Oracle SQL developer, even for developement.
Thanks & Regards
RK Veluvali
What error are you getting when you run datapump expdp? If all you want it views you could run
expdp user/password include=views schema=schema_list ...
Please post the version you are using and the errors.
Thanks
Dean
Similar Messages
-
Is it possible to export tables from diffrent schema using expdp?
Hi,
We can export tables from different schema using exp. Ex: exp user/pass file=sample.dmp log=sample.log tables=scott.dept,system.sales ...But
Is it possible in expdp?
Thanks in advance ..
Thanks,Hi,
you have to use "schemas=user1,user2 include=table:"in('table1,table2')" use parfileexpdp scott/tiger@db10g schemas=SCOTT include=TABLE:"IN ('EMP', 'DEPT')" directory=TEST_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.log{quote}
I am not able to perform it using parfile also.Using parfile it shows "UDE-00010: multiple job modes requested, schema and tables."
When trying the below, i get error
{code}
bash-3.00$ expdp directory=EXP_DUMP dumpfile=test.dmp logfile=test.log SCHEMAS=(\'MM\',\'MMM\') include=TABLE:\"IN\(\'EA_EET_TMP\',\'WS_DT\'\)\"
Export: Release 10.2.0.4.0 - 64bit Production on Friday, 15 October, 2010 18:34:32
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Username: / as sysdba
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_SCHEMA_01": /******** AS SYSDBA directory=EXP_DUMP dumpfile=test.dmp logfile=test.log SCHEMAS=('MM','MMM') include=TABLE:"IN('EA_EET_TMP','WS_DT')"
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "MM"."EA_EET_TMP" 0 KB 0 rows
ORA-39165: Schema MMM was not found.
Master table "SYS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
Dump file set for SYS.SYS_EXPORT_SCHEMA_01 is:
/export/home/nucleus/dump/test.dmp
Job "SYS"."SYS_EXPORT_SCHEMA_01" completed with 1 error(s) at 18:35:19
{code}
When checking expdp help=y shows :-
{code}TABLES Identifies a list of tables to export - one schema only.{code}
As per few testing,tables from different schemas are not possible to export using expdp in a single command.
Anand -
Export sequence from once schema to another using dbms_datapump
Hello,
Can anybody help me how to export only sequences from one schema to another using dbms_datapump or using any other packages.
I cannot use the expdp/impdp from command prompt.
Thanks.Hello Richard,
No luck yet, it's new one now.
declare
l_dp_handle NUMBER;
v_job_state varchar2(4000);
l_last_job_state VARCHAR2(30) := 'UNDEFINED';
l_job_state VARCHAR2(30) := 'UNDEFINED';
l_sts KU$_STATUS;
v_logs ku$_LogEntry;
v_row PLS_INTEGER;
BEGIN
dbms_output.put_line('get_sequence - Started');
l_dp_handle := DBMS_DATAPUMP.open(operation => 'IMPORT',
job_mode => 'SCHEMA',
remote_link => 'PSUP_DATA',
version => 'LATEST');
dbms_output.put_line('get_sequence - get handle :'||l_dp_handle);
DBMS_DATAPUMP.add_file(handle => l_dp_handle,
filename => 'test.log',
directory => 'DMPDIR',
filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE); dbms_output.put_line('get_sequence - add file');
DBMS_DATAPUMP.METADATA_FILTER(l_dp_handle, 'SCHEMA_LIST', '''PSUP_DATA'''); dbms_output.put_line('get_sequence - metadata filer1');
DBMS_DATAPUMP.METADATA_FILTER(l_dp_handle,
'INCLUDE_PATH_EXPR',
'IN (''SEQUENCE'')'); dbms_output.put_line('get_sequence - metadata filer2');
DBMS_DATAPUMP.METADATA_REMAP(l_dp_handle,
'REMAP_SCHEMA',
'PSUP_DATA',
'IRIS_DATA'); dbms_output.put_line('get_sequence - metadata remap');
DBMS_DATAPUMP.start_job(l_dp_handle); dbms_output.put_line('get_sequence - starting job');
DBMS_DATAPUMP.WAIT_FOR_JOB(l_dp_handle, v_job_state);
dbms_output.put_line('get_sequence - completed');
exception
WHEN OTHERS THEN
dbms_datapump.get_status(NULL, 8, 0, v_job_state, l_sts);
v_logs := l_sts.error;
v_row := v_logs.FIRST;
LOOP
EXIT WHEN v_row IS NULL;
dbms_output.put_line('logLineNumber=' || v_logs(v_row).logLineNumber);
dbms_output.put_line('errorNumber=' || v_logs(v_row).errorNumber);
dbms_output.put_line('LogText=' || v_logs(v_row).LogText);
v_row := v_logs.NEXT(v_row);
END LOOP;
RAISE;
end;
get_sequence - Started
get_sequence - get handle :58
get_sequence - add file
declare
ERROR at line 1:
ORA-31623: a job is not attached to this session via the specified handle
ORA-06512: at "SYS.DBMS_DATAPUMP", line 2772
ORA-06512: at "SYS.DBMS_DATAPUMP", line 3886
ORA-06512: at line 43
ORA-39001: invalid argument value
I go ogled some of adive i could see is grant create table to user, but my user is having DBA role as well.
Please help. -
Renaming View from another schema
Hi,
I've 2 schemas namely department , hr
Now department schema is having one table EMP . And a view is created on that table with the name R_EMP
Schema Name : department
Table Name : EMP
View Name : R_EMP
GRANT SELECT ON R_EMP TO HR ;
In HR schema a synonym has been created on view R_EMP with the name R_EMP .
CREATE OR REPLACE SYNONYM hr.R_EMP for department.R_EMP
Schema Name : hr
Synonym Name: R_EMP
Now I want to rename the view name R_EMP to V_EMP from HR schema only
So, I tried the folloiwng syntax in HR schema (All the operations should be done from this schema only )
[code]
RENAME department.R_EMP to department.V_EMP ;
Error:
ORA-01765: specifying table's owner name is not allowed
[/code]
How to change the syntax to make the statement work from HR schema .
Thank You .Smile,
The questions is pretty much answered now. You might want to have a look at this as well.
How to rename a table in another user's schema
You can alter the session to set your current schema to the name of the schema where you want to rename the view and then do a direct rename.
Thanks,
Ishan -
Error using views from other schema
Hello,
i recently had problems using the execute immediate statement in Object Types.
The SQL statement tried to select from some views which were owned by an other schema.
Although we had public synonyms on these views and the same dynamic sql could be used out of a stored procedure the usage in the object type raised a "table or view does not exist exception".
using the same views in the same schema where the object types belonged to, was ok.
example:
schema: scott
view: my_view
schema: dave
sql: "select from scott.my.view ....."
works well from a stored procedure, but nor if used in an object type
create the view in schema "dave" an then
sql: "select from my.view ....."
works fine.
So is someone aware of this behaviour?
Is this a bug or a feature?
regards
peterHello Geoff,
here is the sample code.
If the table my_table belongs to the same
schema runningthe code the code runs with
no exception.
But if the table belongs to an other schema
(lets say SCOTT),
only having global synonyms and the rigths to
select on it, the code will raise an exception "table or view does not exist"
even if we use SCOTT.my_table in the
select.
create type query_o as object(
dummy integer,
static function get_query return
varchar2;
create or replace type body query_o as
static function get_query return varchar2
as
query varchar2(4000) :=
'select ' | |
' f.amount_month ' | |
'into :r1 ' | |
'from ' | |
' my_table f ' | |
'where id=:p1 ';
begin
return query;
end;
end;
create type consumer_o as object(
amount_month number,
member function find(p_id in integer)
return consumer_o
create type body consumer_o as
member function find(p_id in integer)
return consumer_o
as
l_amount number;
begin
execute immediate query_o.get_query()
using out l_amount,
in p_id;
return consumer_o( l_amount );
end;
end;
kind regards
peetr -
Export data from one schema to another schema through sql
Hello.
I have 2 schemes. One is called MICC_ADMIN and the other one is called MICC_PROD. What I want is to export from MICC_ADMIN to import in MICC_PROD. I tried to do it with the Data Workshop tool, but one of the table has around 19.000 records, so it gets frozen when is trying to export the data. So I'm wondering if is there any way to do it through sql command. Thanks.
Regards, Bernardo.I am going to assume that you:
1) want to export DB objects from the source schema (MICC_ADMIN) to your target schema (MICC_PROD)
2) awant to export the data held in the aforementioned tables between the two schemas
Firstly, generate the relevant DDL for your DB objects (you can do this in APEX as well - Home>Utilities>Generate DDL then complete the wizard) and run the DDL script in your target schema.
Secondly, grant access to the relevant tables in the source schema to your target schema and compose DML insert statements to transfer the data from one to another (remembering to disable the relevant constraints/triggers during the process).
Thereafter, revoke access to your source schema.
You can, of course execute this in a single script, although better to do so in a test environment first if you can! -
Can't see DDL of views from other schemas in Developer?
Hi,
I've seen elements of this problem in other threads but this problem of course has it's own twist.
I can see other schema's objects EXCEPT VIEW DDL.
I have given a user every role and priv that I can and they still can't see the view ddl of another schema. They can see procedures, functions etc. just not the view. I've found that if I use the user that created the users I can see the DDL of all subordinate users. Users created under that schema can not see each others views no matter what rights are given. Interestingly enough sometimes when I look to display view DDL it will flash the DDL briefly before blanking the screen. very frustrating. All the Toad fanboys are crowing about how they couldn't possibly use a tool that doesn't allow them to see other view source.
I have also looked for settings in the preferences but could find none.
Is this a bug? It seems like one to me.
Any help is greatly appreciated.
Thanks
MarkWe have a bug logged for this.
Sue -
Export documentation from schema
Hi,
there is a way to export documentation from oracle schema (something lije java api documentation)?
thanksYou can get all list of comments for your tables by viewing
DBA_COL_COMMENTStable. Please refer to documentation for more information
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_4009.htm#SQLRF01109
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com -
ORA-12008:ERR OCCCURS WHEN MATERIALIZED VIEW IS REFRESHED FROM OTHER SCHEMA
Hi,
ORA-12008: Error occcurs when materialized view is refreshed from another schema, Following the output of the trace file when error occured.
/u01/app/oracle/admin/orcl92/bdump/orcl92_j000_23729.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1
System name: Linux
Node name: newdbserver
Release: 2.6.9-5.ELsmp
Version: #1 SMP Wed Jan 5 19:30:39 EST 2005
Machine: i686
Instance name: orcl92
Redo thread mounted by this instance: 1
Oracle process number: 164
Unix process pid: 23729, image: oracle@newdbserver (J000)
*** SERVICE NAME:(SYS$USERS) 2008-05-23 10:30:51.848
*** SESSION ID:(462.21166) 2008-05-23 10:30:51.848
*** 2008-05-23 10:30:51.848
ORA-12012: error on auto execute of job 766
ORA-12008: error in materialized view refresh path
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2255
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2461
ORA-06512: at "SYS.DBMS_IREFRESH", line 683
ORA-06512: at "SYS.DBMS_REFRESH", line 195
ORA-06512: at line 1
Regards,
AbhishekHi Damorgan,
As i said, when refresh materialized view from another schema, mentioned error occurs.
I have also granted accees explicitely still following error occurs.
ORA-12008: error in materialized view refresh path
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2255
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2461
ORA-06512: at "SYS.DBMS_IREFRESH", line 683
ORA-06512: at "SYS.DBMS_REFRESH", line 195
ORA-06512: at line 1
Regards,
Abhishek
Message was edited by:
AbhishekRathod(user559364) -
Import from other schemas other than default
Hi,
I defined a source metadata location to an Oracle database. The user used to connect to the DB itself has no objects. I need to import tables and views from other schemas in the source Oracle database. It that possible using the same user that was used in creating the metadata source location? Or, does one need specific one-to-one connection established as separate source metadata locations in order to import tables and views from other schemas?
In other words, is one user/password to a database sufficient to import tables and views from other schemas?
Thanks!I'm not sure you can import directly into the Android version of Firefox due to security limitation on the device. If you can get your Opera bookmarks into Firefox on the desktop, you can use Firefox Sync to move them to your mobile.
Does this thread help? [https://support.mozilla.org/en-US/questions/923976 how can I sync bookmarks between my opera mobile browser and my new Firefox for android browser ? | Firefox Support Forum | Firefox Help] -
How to export all the views in one schema?
Hi,
I have more than 1000 views in one shcema.
How to export all the views in one schema?
AmyHi,
It's not a very easy question, I have develop a script wich create a script to create view from old database to new database :
/* &1: Oracle SID Source
/* &2: Oracle Schema Source
SET HEAD OFF
SET VERIFY OFF
SET PAGESIZE 0
SET LONG 40000000
SET LONGCHUNKSIZE 2000
SET LINESIZE 2000
SET FEEDBACK OFF
CREATE TABLE RECREATE_VIEW(VIEW_NAME VARCHAR2(30), TEXT LONG);
/* Selection du texte de la vue */
DECLARE
w_text long;
w_text_debut long;
w_text_column long;
w_view varchar2 (30);
w_schema varchar2 (8):='&2';
CURSOR w_cursor IS
SELECT a.view_name, a.text
FROM dba_views a
WHERE a.owner = w_schema;
CURSOR w_column IS
SELECT DECODE (ROWNUM,
1, 'CREATE OR REPLACE FORCE VIEW ' || '&' || '1..'
|| a.table_name || chr(10)
|| '('
|| a.column_name
|| DECODE (ROWNUM, nbcolumns, ')' || chr(10) || 'AS' || chr(10), ',' || chr(10))
FROM (select column_name,table_name
FROM dba_tab_columns
WHERE owner = '&1'
AND table_name = w_view
order by column_id ) a,
(SELECT COUNT (1) nbcolumns
FROM dba_tab_columns
WHERE owner = '&1'
AND table_name = w_view
GROUP BY owner, table_name) b
order by rownum;
BEGIN
OPEN w_cursor;
LOOP
FETCH w_cursor INTO w_view, w_text;
EXIT WHEN w_cursor%NOTFOUND;
w_text_debut := NULL;
w_text_column := NULL;
OPEN w_column;
LOOP
FETCH w_column INTO w_text_column;
EXIT WHEN w_column%NOTFOUND;
w_text_debut := w_text_debut || w_text_column || ' ';
w_text_column := NULL;
END LOOP;
CLOSE w_column;
w_text := w_text_debut||w_text||';';
insert into RECREATE_VIEW(VIEW_NAME, TEXT) VALUES (w_view, w_text);
COMMIT;
w_text := NULL;
w_view := NULL;
END LOOP;
CLOSE w_cursor;
END;
SPOOL scripts_views_&1..sql
PROMPT SPOOL scripts_views_&1..log
PROMPT
SELECT TEXT
FROM RECREATE_VIEW;
PROMPT
PROMPT SPOOL OFF
PROMPT
SPOOL off
PROMPT /* Formattage du fichier SQL */
!sed 's/[ ]*$//' scripts_views_&1..sql > aprilia.tmp
!rm scripts_views_&1..sql
!mv aprilia.tmp scripts_views_&1..sql
DROP TABLE RECREATE_VIEW;
EXIT
I hope that help you.
Nicolas. -
Export views and business areas from dev to prod.
Hi Gurus,
I am using oracle database 10gR2 and Oracle BI Discoverer Administration 10gR2.
I have an End User Layer disadmin1 with 10 business areas. This EUL also have folders for the views in its own schema. I used original import/export utility to export this EUL from Development to Production environment.I exported the schema disadmin1 form development and imported it into production into same shcema disadmin1 (This exported the views too) . It is absolutely working fine.
Now I have to develop 5 more business areas in the same EUL as phase 2 development I am keeping the EUL disadmin1 for bug fixing for initial 10 BAs, and I have another EUL disadmin2 to develop new business areas. For these new business areas, I have to firrst create views and then create folders on these views in disadmin2. I will export the new business areas form discoverer utility 'Selected Business Areas' from disadmin2 and will import them into production in original EUL disadmin1. My problem is how can I export new views from development to production.
Thanks for the help.With Discoverer, there is not necessarily one right way to do things. There is certainly nothing wrong with the process you are doing. I believe Oracle had a different process in mind with Oracle, but that does not mean your process is wrong. Did you install the seeded (Oracle term) business areas that come with Discoverer, and activated the business views for those Oracle business areas? Put those into Production and your users can develop workbooks on the fly in Production, rather than wait for something to go through a development-test-production process. Which can be good or bad depending on your individual situation. As for creating new views, I suggest talking to your Oracle technical team to see what process they have for approving new views in production and getting those views created. I would suggest getting those approved and created first before relying on using them for Discoverer development (just in case the creation is not approved), but that is just my opinion.
John Dickey -
Not able to export web analysis report to excel smart view from workspace
Not able to export web analysis report to excel smart view from workspace.
Error :Web launch operation has been cancelled.
Can anyone help me to resolve this issuesI realized that I can put a block in WebI and then I can pull that in excel alongside of static header, after putting the question.
My interest to know whether it is by design in XI 3.0 or it is an issue. But by the replies it seems to me like it is by design.
@Anis: I can't go for header as part of Body. Because this report is viewed in Web by many other users. I can't have separate report for Live office, it is a restriction for me. If I use the header in body, it wont look good I guess. -
IMPORT a VIEW from an export dump file
I'm trying to import a view from an export dump file. In using the Import Utility, do I use the TABLE parameter and give the View name ie: TABLES=view1
nullOnly I want to do is import ONE view from an export dmp file that contains hundereds of table, many views and procedures. I do not want to reimport everything from the export file.
-
Create a View from tables of different schemas
hi all,
can u pls give solution to create a View from tables of different schemas.
i have to bring data from one DB Server A,
which contains different schemas and tables in the schemas...
i need to insert that data in another DBServer B.
i made a procedure for this...
but when the connection fails from A, then i could not get data...
please suggest some solution..
thanks,
neelimaI don't know what database system you use, but in the most I know it is done that way:
SELECT
A.COL1,A.COL2.....
FROM
SCHEMA_NAME.TABLENAME A,
SCHEMA_NAME.TABLE_NAME B
WHERE
A.COL1 = B.COL2
...
Maybe you are looking for
-
Blackberry Desktop Software not responding
Blackberry Desktop Software Not Responding - receiving this message even after uninstall, reinstall. My device is Curve 8320. Thanks.
-
How to Develop New Application in CRM
Hi all, I need your help to guide me in deciding which transactions, customization and/or development tools that i should use for developing new application in CRM to replace an existing web based application? The following steps are some the curren
-
hi, when saving the sales order we are getting error G/l account is not assigned . can anyone suggest for any solution Regards, Murali
-
On/off button??
I am wanting to trade in my iphone 4 for the new iphone. My on/off button is stuck, but you can still turn the phone on and off, you just have to press down a little harder. My question is, am I able to press yes when they ask if the on/off button is
-
HDV sequence settings???
This is my first HDV project and I've digitized all my footage (HDV 1080i) BUT need to know the correct settings for my sequence.... this is what I have so far and would like to know if this is correct? Frame Size: 1920x1080 Aspect Ratio HDTV 1080i (