Script to copy all the objects within a Stored Procedure
I am trying to copy all the objects from one database to another using Scripts. Now I need to put that script inside a Stored Procedure.
Thanks.
Refer this vbscript to generate all object scripts programatically,
http://www.codeproject.com/Articles/16195/How-to-Script-Out-SQL-Server-Objects
or
Using SSMS
http://msdn.microsoft.com/en-IN/library/hh245282.aspx#GenPubScriptWiz
Regards, RSingh
Similar Messages
-
I want to copy all the objects from one user to another... Please help
Hii Experts.... I have a problem here. Please give me solution for this...
I am using Oracle 11g on my windows XP system.
I created a new user named "some"
I want to copy all the objects from scott user to some user... Please help me
Please Explain me in detailed way
Thank youSowmyRaj wrote:
Hii Experts.... I have a problem here. Please give me solution for this...
I am using Oracle 11g on my windows XP system.
I created a new user named "some"
I want to copy all the objects from scott user to some user... Please help me
If all what you are interested is Scott schema than no need to use the datapump or CTAS. Run demobld.sql in your schema and it would have all the objects of Scott.
http://www.oracle.com/technology/sample_code/tech/sql_plus/htdocs/demobld.html
HTH
Aman.... -
Copy all the objects from the one system that start with (ZANK)
hi to all,
I have installed the name space /ank/ in the US system, we need to copy all the objects from the India system that start with (Zank) and re-create them as /ank/. problem is how can i copy objects and re-create.
thanksHi Ankal,
I guess this is your second thread on the same question. Ok provide these information
>>I have installed the name space /ank/ in the US system,
Are you saying that you have a machine (US System) and i has a namespace /ank/ ? What all objects are there in this namespace?
>>we need to copy all the objects from the India system that start with (Zank) and re-create them as /ank/.
Is the India system on the same US system?
Also tell me whether you have opened the home page of SAP XI/PI? If yes , are you able to open Integration Repository? If yes then how these US and India systems are referred in Integration Repository? Are they referred as separate software components?
Regards
Suraj -
How can i access all the objects of one schema from another schema
Dear All,
How can i access all the objects(Tables,Views,Triggers,Procedures,Functions,Packages etc..) and do the modifications of one schema from another schema (Without using synonyms concept).
Thanks in advance,
MahiFirst of all, synonyms only help you easy reference the object. It doesn't have any implication of object privilege.
As long as you have proper privilege on target object. You can access it with or without synonyms.
Assuming you have proper privilege of objects, you can use following command to assume schema owner.
ALTER SESSION SET CURRENT_SCHEMA = Schema_owner -
How to copy a database with all the objects and relationship but with no data
Hello Experts
I am here for your advise as usual, I want to create a copy of my current database from an existing one on SQL Server 2008r2 Standard Edition, here is what I need, I want all the objects including any relationship between the objects and I do
not need any data. I have some idea for using the general script in SSMS, but I still need you expertise advise please, thank you kindly for your help.
RegardsOne option is to run BACKUP/RESTORE, once you have restored you run:
SELECT 'ALTER TABLE ' + quotename(s.name) + '.' + quotename(o.name) +
' DISABLE TRIGGER ALL '
FROM sys.schemas s
JOIN sys.objects o ON o.schema_id = s.schema_id
WHERE o.type = 'U'
AND EXISTS (SELECT *
FROM sys.triggers tr
WHERE tr.parent_id = o.object_id)
Copy result and paste into a query window do to run. Next:
SELECT 'DELETE ' + quotename(s.name) + '.' + quotename(o.name)
FROM sys.schemas s
JOIN sys.objects o ON o.schema_id = s.schema_id
WHERE o.type = 'U'
Run this result until you don't get any more errors.
Run the first query again, but change DISABLE to ENABLE.
This is more long-winding than scripting, particularly if you have lots of data. But you know that you will not make any changes whatsoever to the schema.
The scripting in SSMS generally does it right, I believe, but some items are not scripted by default. If you run BACKUP/RESTORE, you know that you get a faithful copy.
Of course, the best way is to keep your code under version control and take the version control system as your ultimate truth.
Erland Sommarskog, SQL Server MVP, [email protected] -
Script to generate all the tables and objects in a schema
how to write a script to generate all the tables and objects in a schema.
with toad the no of tables generated is not matching when i check from schema .Dear Sidhant,
Try this script:
set termout off
set feedback off
set serveroutput on size 100000
spool ddl_schema.sql
begin
dbms_output.put_line('--');
dbms_output.put_line('-- DROP TABLES --');
dbms_output.put_line('--');
for rt in (select tname from tab order by tname) loop
dbms_output.put_line('DROP TABLE '||rt.tname||' CASCADE CONSTRAINTS;');
end loop;
end;
declare
v_tname varchar2(30);
v_cname char(32);
v_type char(20);
v_null varchar2(10);
v_maxcol number;
v_virg varchar2(1);
begin
dbms_output.put_line('--');
dbms_output.put_line('-- CREATE TABLES --');
dbms_output.put_line('--');
for rt in (select table_name from user_tables order by 1) loop
v_tname:=rt.table_name;
v_virg:=',';
dbms_output.put_line('CREATE TABLE '||v_tname||' (');
for rc in (select table_name,column_name,data_type,data_length,
data_precision,data_scale,nullable,column_id
from user_tab_columns tc
where tc.table_name=rt.table_name
order by table_name,column_id) loop
v_cname:=rc.column_name;
if rc.data_type='VARCHAR2' then
v_type:='VARCHAR2('||rc.data_length||')';
elsif rc.data_type='NUMBER' and rc.data_precision is null and
rc.data_scale=0 then
v_type:='INTEGER';
elsif rc.data_type='NUMBER' and rc.data_precision is null and
rc.data_scale is null then
v_type:='NUMBER';
elsif rc.data_type='NUMBER' and rc.data_scale='0' then
v_type:='NUMBER('||rc.data_precision||')';
elsif rc.data_type='NUMBER' and rc.data_scale<>'0' then
v_type:='NUMBER('||rc.data_precision||','||rc.data_scale||')';
elsif rc.data_type='CHAR' then
v_type:='CHAR('||rc.data_length||')';
else v_type:=rc.data_type;
end if;
if rc.nullable='Y' then
v_null:='NULL';
else
v_null:='NOT NULL';
end if;
select max(column_id)
into v_maxcol
from user_tab_columns c
where c.table_name=rt.table_name;
if rc.column_id=v_maxcol then
v_virg:='';
end if;
dbms_output.put_line (v_cname||v_type||v_null||v_virg);
end loop;
dbms_output.put_line(');');
end loop;
end;
declare
v_virg varchar2(1);
v_maxcol number;
begin
dbms_output.put_line('--');
dbms_output.put_line('-- PRIMARY KEYS --');
dbms_output.put_line('--');
for rcn in (select table_name,constraint_name
from user_constraints
where constraint_type='P'
order by table_name) loop
dbms_output.put_line ('ALTER TABLE '||rcn.table_name||' ADD (');
dbms_output.put_line ('CONSTRAINT '||rcn.constraint_name);
dbms_output.put_line ('PRIMARY KEY (');
v_virg:=',';
for rcl in (select column_name,position
from user_cons_columns cl
where cl.constraint_name=rcn.constraint_name
order by position) loop
select max(position)
into v_maxcol
from user_cons_columns c
where c.constraint_name=rcn.constraint_name;
if rcl.position=v_maxcol then
v_virg:='';
end if;
dbms_output.put_line (rcl.column_name||v_virg);
end loop;
dbms_output.put_line(')');
dbms_output.put_line('USING INDEX );');
end loop;
end;
declare
v_virg varchar2(1);
v_maxcol number;
v_tname varchar2(30);
begin
dbms_output.put_line('--');
dbms_output.put_line('-- FOREIGN KEYS --');
dbms_output.put_line('--');
for rcn in (select table_name,constraint_name,r_constraint_name
from user_constraints
where constraint_type='R'
order by table_name) loop
dbms_output.put_line ('ALTER TABLE '||rcn.table_name||' ADD (');
dbms_output.put_line ('CONSTRAINT '||rcn.constraint_name);
dbms_output.put_line ('FOREIGN KEY (');
v_virg:=',';
for rcl in (select column_name,position
from user_cons_columns cl
where cl.constraint_name=rcn.constraint_name
order by position) loop
select max(position)
into v_maxcol
from user_cons_columns c
where c.constraint_name=rcn.constraint_name;
if rcl.position=v_maxcol then
v_virg:='';
end if;
dbms_output.put_line (rcl.column_name||v_virg);
end loop;
select table_name
into v_tname
from user_constraints c
where c.constraint_name=rcn.r_constraint_name;
dbms_output.put_line(') REFERENCES '||v_tname||' (');
select max(position)
into v_maxcol
from user_cons_columns c
where c.constraint_name=rcn.r_constraint_name;
v_virg:=',';
select max(position)
into v_maxcol
from user_cons_columns c
where c.constraint_name=rcn.r_constraint_name;
for rcr in (select column_name,position
from user_cons_columns cl
where rcn.r_constraint_name=cl.constraint_name
order by position) loop
if rcr.position=v_maxcol then
v_virg:='';
end if;
dbms_output.put_line (rcr.column_name||v_virg);
end loop;
dbms_output.put_line(') );');
end loop;
end;
begin
dbms_output.put_line('--');
dbms_output.put_line('-- DROP SEQUENCES --');
dbms_output.put_line('--');
for rs in (select sequence_name
from user_sequences
where sequence_name like 'SQ%'
order by sequence_name) loop
dbms_output.put_line('DROP SEQUENCE '||rs.sequence_name||';');
end loop;
dbms_output.put_line('--');
dbms_output.put_line('-- CREATE SEQUENCES --');
dbms_output.put_line('--');
for rs in (select sequence_name
from user_sequences
where sequence_name like 'SQ%'
order by sequence_name) loop
dbms_output.put_line('CREATE SEQUENCE '||rs.sequence_name||' NOCYCLE;');
end loop;
end;
declare
v_virg varchar2(1);
v_maxcol number;
begin
dbms_output.put_line('--');
dbms_output.put_line('-- INDEXES --');
dbms_output.put_line('--');
for rid in (select index_name, table_name
from user_indexes
where index_name not in (select constraint_name from user_constraints)
and index_type<>'LOB'
order by index_name) loop
v_virg:=',';
dbms_output.put_line('CREATE INDEX '||rid.index_name||' ON '||rid.table_name||' (');
for rcl in (select column_name,column_position
from user_ind_columns cl
where cl.index_name=rid.index_name
order by column_position) loop
select max(column_position)
into v_maxcol
from user_ind_columns c
where c.index_name=rid.index_name;
if rcl.column_position=v_maxcol then
v_virg:='';
end if;
dbms_output.put_line (rcl.column_name||v_virg);
end loop;
dbms_output.put_line(');');
end loop;
end;
spool off
set feedback on
set termout on Best Regards,
Francisco Munoz Alvarez
www.oraclenz.com -
Copying all the contents of a Vbox to a clipboard
Hello sir,
Can someone please help me out with copying the data inside a VBox to a clipboard.
I have a Vbox and inside it there are 10 label objects along with a list component.
Is there a way to copy all the data to the clipboard in one attempt.
Thanks in advance.here it is.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:VBox id="controls">
<!-- <mx:Label id="o1" text="Test1"/>
<mx:Label id="o2" text="Test1"/>
<mx:Label id="o3" text="Test1"/>
<mx:Label id="o4" text="Test1"/>
<mx:Label id="o5" text="Test1"/>
<mx:Label id="o6" text="Test1"/>
<mx:Label id="o7" text="Test1"/>
<mx:Label id="o8" text="Test1"/>
--> <mx:Repeater id="myRep" dataProvider="{myArray}">
<mx:Label
id="myLabel"
text="This is loop #{myRep.currentIndex}" />
</mx:Repeater>
<mx:List id="source" width="100%" color="blue"
dataProvider="{mystates.state}"/>
</mx:VBox>
<mx:Model id="mystates">
<states>
<state label="Alabama"/>
<state label="Alaska"/>
<state label="Arizona"/>
<state label="Arkansas"/>
<state label="California"/>
<state label="Colorado"/>
<state label="Connecticut"/>
</states>
</mx:Model>
<mx:Script>
<![CDATA[
import mx.utils.ObjectProxy;
import mx.collections.ArrayCollection;
import mx.controls.Label;
[Bindable]
public var myArray:Array=[1,2,3,4];
private function copytoClickBoard():void
var arr:Array = [];
arr = controls.getChildren()
var copyData:String = "";
for each(var obj:Object in arr)
if(obj is Label)
copyData +=obj.text + "\t\n";
if(obj is List)
for each(var objx:ObjectProxy in obj.dataProvider)
copyData += objx.label+ "\t\n";
System.setClipboard(copyData);
]]>
</mx:Script>
<mx:Button id="copy" label="Copy 2 CBoard" click="copytoClickBoard()"/>
</mx:Application> -
Hi all,
I have the form that show all the .fmx file within specific directory (e.g : c:\forms).
Is there anyway to list all the objects in selected .fmx ?
Say, test.fmx have :
* Block A :
- Item A1
- Item A2
* Block B :
- Item B1
- Item B2
Regards,
Fendyuse API.
-
How do I find out all the objects I use in my application.
As I am creating my documentation, I realized it would be helpful to know all the objects that my application uses ( tables, views, packages etc). Is there a way to find that out i.e. any script or simple alternative etc ?
Thanks, folks!I am on version 3.0.1.00.08 and am trying to figure this out for this version.The navigation path is different but the report is available somewhere.
Also, is there a way to get the sql from all the pages out ?What do you mean?
Scott -
To capture all the objects from an tablespace and restore.
Hi All,
I have a situation in the Schema refresh process where i may have to delete a tablespace and its datafiles.
Then I have to recreate it as it was before and restore all it objects .
Is there any way that i can capture all the objects of that tablespace before it is deleted and then later restore it back as it was .
Any Expert sugggestion is highly apprciated .
The Platform is as below ..
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Thanks In Advance .There are 2 methods you could use with Data Pump.
1. tablespace mode export. expdp user/password tablespaces=<your list here> ...
2. transportable tablespace mode. expdp user/password transport_tablespaces=<your tablespace list here> ...
NOTE: for #2, you need to have your tablespaces in read only mode, then you need to copy the data files, and the
tablespaces need to be self contained.
Hope this helps.
Dean -
I own multiple systems. I have hardened one browser following the guideline provided by CISecurity. Instead of repeating all the configurations performed on that one system, can I just copy all the ".js" files from the secured system to my other systems?
The ".js" files can be modified using a text editor. Is there a way to lock down these files to prevent modification?Dear Joel
i know two ways to prevent browser from caching your files
First : The Hard way
just add ? +Math.random() in the end of your file
Like this :
in HTML :
<script type="text/javascript">
(function(){
var e = document.getElementsByTagName("script")[0];
var d = document.createElement("script");
d.src = "index_edgePreload.js?"+Math.random()+"";
d.type = "application/javascript";
d.async = true;
d.defer = true;
e.parentNode.insertBefore(d,e);
</script>
instead of this Line in HTML that created by EA :
<script type="application/javascript" src="index_edgePreload.js></script>
Disadvantage : you should do this for all of files you want to prevent from caching
===================================================
Second : The easyest way
You Should have Access to .htaccess file in your Server
Open your .htaccess file and paste these codes in it :
ExpiresActive On
ExpiresByType application/json "access plus 1 seconds"
ExpiresByType text/json "access plus 1 seconds"
ExpiresByType text/plain "access plus 1 seconds"
ExpiresDefault "access plus 1 month"
you can type what ever type of file you want to prevent from caching in browser
Advantage : after do this in your .htaccess file all files with the type you want will not Cache in your browser
Easy is'nt it ?
Zaxist -
How to copy all the javascript of a page to another, including the fields javascript
I have a PDF form with fields that have validation and formating scripts done in Javascript. I have another PDF form with equal fields: the fields are the same, same name same everything.....
I want to copy all the fields scripts from 1 document to the other so that I doint have to retype all the javascript in all the fields. How can I do this????
I am using Acrobat Pro 8.1.2
Thanks
MarcHow do I copy them all with Edit All Javascripts?
I tried adding new scripts to the file produced and saving it, but the new scripts were not in the PDF with I was done. At least I couldn't see them when I edited again. -
How can I copy all the comments from my picture/s in fotostream to my picture/s in my library?
Hi, first, you should prevent the iTunes library auto sync with iPhone: Launch iTunes > click Preferences... > click Devices. In the window, check the option 'Prevent iPods, iPhones, and iPads from syncing automatically'. Next, connect your iPhone with your computer via the USB cable. Click the mini menu for iTunes on the very top left and click the option 'Show menu bar'. After then you can see iTunes File, Edit, View, Control, Store and Help menus on the ribbon. Click File > Devices > Transfer purchases from (your iPhone name). You can also access to the File menu by holding down Alt (Option on Mac), Shift and F keys. This is how to get your iPhone purcahsed song transferred to iTunes Library.
-
Hello everybody,
I would like to copy all the songs from one Ipod into another. All the songs are into my Itunes account, I tried to drag and drop the songs from the old Ipod to the new one but it doesn't work. Is there a way to do it ?
I share one Itunes account with other people from my family and one person would like to keep the same songs on the new Ipod as the ones which were on the old one.
Thanks in advance for your answer.
YanHello Chris,
Thanks for your answer. I was hoping for an easier answer. Too bad there is no drag and drop solution, it would have been much easier.
Thanks for answering so fast.
Bye.
Yan -
How can I copy all the files from my iMac to an external drive so they remain as 'regular accessible files'? I want to clean my dive
You can use a program like Carbon Copy Cloner. It will clone your HD to the external. The format is the same as your internal drive and you can boot from it using Option key at boot time.
http://www.bombich.com/
Regards,
Captfred
Maybe you are looking for
-
I had a bunch of CD's i put in on my itunes and wanted to put it in my phone but it didn't work and swiped all my music previously that has been on my phone. I dont know how to fix this and dont know how to sync my music in. I keep syncing and it s
-
IPad photo issues with third party apps
Up until recently I've had no problem with the issue I'm about to describe. When I download my raw format photos from my camera using the SD card reader I cannot view full photos in any third party apps such as the Photoshop app or any other I've tri
-
Change Default Surround Sound Audio Mapping
Anyone know if there is a way to change the default surround sound audio mapping in Premiere CS6? For example, when working with six mono channels being sent to a 5.1 submix. I manually set where each of the six go (front left, front right, center, l
-
Interface Builder and subclassing
Is it possible for me to have the outlet in Interface Builder pointing to a superclass... then in the code using that interface to point to a subclass? So for example, suppose I'm setting up an interface in Interface Builder with a HumanView (let's s
-
Do educational licenses expire?
We have been using CS3 Photoshop, Acrobat and Illustrator for Mac for several years and now we get an error message that says the license has quit working. Do educational licenses expire? OTOH, the error message also suggests uninstalling and reinst