Create script for installing underlying tables
Please let me know what steps to follow to create scripts to include (exproting of tables_data ) while exporting a packaged application
utility exp rows=N/imp show=y or package dbms_metadata
SQL> select dbms_metadata.get_ddl('TABLE','EMP') from dual;
DBMS_METADATA.GET_DDL('TABLE',
CREATE TABLE "SCOTT"."EMP"
( "EMPNO" NUMBER(4,0),
"ENAME" VARCHAR2(10),
"JOB" VARCHAR2(9),
"MGR" NUMBER(4,0),
"HIREDATE" DATE,
"SAL" NUMBER(7,2),
"COMM" NUMBER(7,2),
"DEPTNO" NUMBER(2,0),
CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TOOLS" ENABLE,
CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO")
REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TOOLS"HTH
Laurent Schneider
OCM DBA
Similar Messages
-
TIPS(18) : CREATING SCRIPTS TO RECREATE A TABLE STRUCTURE
제품 : SQL*PLUS
작성날짜 : 1996-11-12
TIPS(18) : Creating Scripts to Recreate a Table Structure
=========================================================
The script creates scripts that can be used to recreate a table structure.
For example, this script can be used when a table has become fragmented or to
get a defintion that can be run on another database.
CREATES SCRIPT TO RECREATE A TABLE-STRUCTURE
INCL. STORAGE, CONSTRAINTS, TRIGGERS ETC.
This script creates scripts to recreate a table structure.
Use the script to reorganise a table that has become fragmented,
to get a definition that can be run on another database/schema or
as a basis for altering the table structure (eg. drop a column!).
IMPORTANT: Running the script is safe as it only creates two new scripts and
does not do anything to your database! To get anything done you have to run the
scripts created.
The created scripts does the following:
1. save the content of the table
2. drop any foreign key constraints referencing the table
3. drop the table
4. creates the table with an Initial storage parameter that
will accomodate the entire content of the table. The Next
parameter is 25% of the initial.
The storage parameters are picked from the following list:
64K, 128K, 256K, 512K, multiples of 1M.
5. create table and column comments
6. fill the table with the original content
7. create all the indexes incl storage parameters as above.
8. add primary, unique key and check constraints.
9. add foreign key constraints for the table and for referencing
tables.
10.Create the table's triggers.
11.Compile any depending objects (cascading).
12.Grant table and column privileges.
13.Create synonyms.
This script must be run as the owner of the table.
If your table contains a LONG-column, use the COPY
command in SQL*Plus to store/restore the data.
USAGE
from SQL*Plus:
start reorgtb
This will create the scripts REORGS1.SQL and REORGS2.SQL
REORGS1.SQL contains code to save the current content of the table.
REORGS2.SQL contains code to rebuild the table structure.
undef tab;
set echo off
column a1 new_val stor
column b1 new_val nxt
select
decode(sign(1024-sum(bytes)/1024),-1,to_char((round(sum(bytes)/(1024*1
024))+1))||'M', /* > 1M new rounded up to nearest Megabyte */
decode(sign(512-sum(bytes)/1024), -1,'1M',
decode(sign(256-sum(bytes)/1024), -1,'512K',
decode(sign(128-sum(bytes)/1024), -1,'256K',
decode(sign(64-sum(bytes)/1024) , -1,'128K',
'64K'
a1,
decode(sign(1024-sum(bytes)/4096),-1,to_char((round(sum(bytes)/(4096*1
024))+1))||'M', /* > 1M new rounded up to nearest Megabyte */
decode(sign(512-sum(bytes)/4096), -1,'1M',
decode(sign(256-sum(bytes)/4096), -1,'512K',
decode(sign(128-sum(bytes)/4096), -1,'256K',
decode(sign(64-sum(bytes)/4096) , -1,'128K',
'64K'
b1
from user_extents
where segment_name=upper('&1');
set pages 0 feed off verify off lines 150
col c1 format a80
spool reorgs1.sql
PROMPT drop table bk_&1
prompt /
PROMPT create table bk_&1 storage (initial &stor) as select * from &1
prompt /
spool off
spool reorgs2.sql
PROMPT spool reorgs2
select 'alter table '||table_name||' drop constraint
'||constraint_name||';'
from user_constraints where r_constraint_name
in (select constraint_name from user_constraints where
table_name=upper('&1')
and constraint_type in ('P','U'));
PROMPT drop table &1
prompt /
prompt create table &1
select decode(column_id,1,'(',',')
||rpad(column_name,40)
||decode(data_type,'DATE' ,'DATE '
,'LONG' ,'LONG '
,'LONG RAW','LONG RAW '
,'RAW' ,'RAW '
,'CHAR' ,'CHAR '
,'VARCHAR' ,'VARCHAR '
,'VARCHAR2','VARCHAR2 '
,'NUMBER' ,'NUMBER '
,'unknown')
||rpad(
decode(data_type,'DATE' ,null
,'LONG' ,null
,'LONG RAW',null
,'RAW' ,decode(data_length,null,null
,'('||data_length||')')
,'CHAR' ,decode(data_length,null,null
,'('||data_length||')')
,'VARCHAR' ,decode(data_length,null,null
,'('||data_length||')')
,'VARCHAR2',decode(data_length,null,null
,'('||data_length||')')
,'NUMBER' ,decode(data_precision,null,' '
,'('||data_precision||
decode(data_scale,null,null
,','||data_scale)||')')
,'unknown'),8,' ')
||decode(nullable,'Y','NULL','NOT NULL') c1
from user_tab_columns
where table_name = upper('&1')
order by column_id
prompt )
select 'pctfree '||t.pct_free c1
,'pctused '||t.pct_used c1
,'initrans '||t.ini_trans c1
,'maxtrans '||t.max_trans c1
,'tablespace '||s.tablespace_name c1
,'storage (initial '||'&stor' c1
,' next '||'&stor' c1
,' minextents '||t.min_extents c1
,' maxextents '||t.max_extents c1
,' pctincrease '||t.pct_increase||')' c1
from user_Segments s, user_tables t
where s.segment_name = upper('&1') and
t.table_name = upper('&1')
and s.segment_type = 'TABLE'
prompt /
select 'comment on table &1 is '''||comments||''';' c1 from
user_tab_comments
where table_name=upper('&1');
select 'comment on column &1..'||column_name||
' is '''||comments||''';' c1 from user_col_comments
where table_name=upper('&1');
prompt insert into &1 select * from bk_&1
prompt /
set serveroutput on
declare
cursor c1 is select index_name,decode(uniqueness,'UNIQUE','UNIQUE')
unq
from user_indexes where
table_name = upper('&1');
indname varchar2(50);
cursor c2 is select
decode(column_position,1,'(',',')||rpad(column_name,40) cl
from user_ind_columns where table_name = upper('&1') and
index_name = indname
order by column_position;
l1 varchar2(100);
l2 varchar2(100);
l3 varchar2(100);
l4 varchar2(100);
l5 varchar2(100);
l6 varchar2(100);
l7 varchar2(100);
l8 varchar2(100);
l9 varchar2(100);
begin
dbms_output.enable(100000);
for c in c1 loop
dbms_output.put_line('create '||c.unq||' index '||c.index_name||' on
&1');
indname := c.index_name;
for q in c2 loop
dbms_output.put_line(q.cl);
end loop;
dbms_output.put_line(')');
select 'pctfree '||i.pct_free ,
'initrans '||i.ini_trans ,
'maxtrans '||i.max_trans ,
'tablespace '||i.tablespace_name ,
'storage (initial '||
decode(sign(1024-sum(e.bytes)/1024),-1,
to_char((round(sum(e.bytes)/(1024*1024))+1))||'M',
decode(sign(512-sum(e.bytes)/1024), -1,'1M',
decode(sign(256-sum(e.bytes)/1024), -1,'512K',
decode(sign(128-sum(e.bytes)/1024), -1,'256K',
decode(sign(64-sum(e.bytes)/1024) , -1,'128K',
'64K'))))) ,
' next '||
decode(sign(1024-sum(e.bytes)/4096),-1,
to_char((round(sum(e.bytes)/(4096*1024))+1))||'M',
decode(sign(512-sum(e.bytes)/4096), -1,'1M',
decode(sign(256-sum(e.bytes)/4096), -1,'512K',
decode(sign(128-sum(e.bytes)/4096), -1,'256K',
decode(sign(64-sum(e.bytes)/4096) , -1,'128K',
'64K'))))) ,
' minextents '||s.min_extents ,
' maxextents '||s.max_extents ,
' pctincrease '||s.pct_increase||')'
into l1,l2,l3,l4,l5,l6,l7,l8,l9
from user_extents e,user_segments s, user_indexes i
where s.segment_name = c.index_name
and s.segment_type = 'INDEX'
and i.index_name = c.index_name
and e.segment_name=s.segment_name
group by s.min_extents,s.max_extents,s.pct_increase,
i.pct_free,i.ini_trans,i.max_trans,i.tablespace_name ;
dbms_output.put_line(l1);
dbms_output.put_line(l2);
dbms_output.put_line(l3);
dbms_output.put_line(l4);
dbms_output.put_line(l5);
dbms_output.put_line(l6);
dbms_output.put_line(l7);
dbms_output.put_line(l8);
dbms_output.put_line(l9);
dbms_output.put_line('/');
end loop;
end;
declare
cursor c1 is
select constraint_name, decode(constraint_type,'U',' UNIQUE',' PRIMARY
KEY') typ,
decode(status,'DISABLED','DISABLE',' ') status from user_constraints
where table_name = upper('&1')
and constraint_type in ('U','P');
cname varchar2(100);
cursor c2 is
select decode(position,1,'(',',')||rpad(column_name,40) coln
from user_cons_columns
where table_name = upper('&1')
and constraint_name = cname
order by position;
begin
for q1 in c1 loop
cname := q1.constraint_name;
dbms_output.put_line('alter table &1');
dbms_output.put_line('add constraint '||cname||q1.typ);
for q2 in c2 loop
dbms_output.put_line(q2.coln);
end loop;
dbms_output.put_line(')' ||q1.status);
dbms_output.put_line('/');
end loop;
end;
declare
cursor c1 is
select c.constraint_name,c.r_constraint_name cname2,
c.table_name table1, r.table_name table2,
decode(c.status,'DISABLED','DISABLE',' ') status,
decode(c.delete_rule,'CASCADE',' on delete cascade ',' ')
delete_rule
from user_constraints c,
user_constraints r
where c.constraint_type='R' and
c.r_constraint_name = r.constraint_name and
c.table_name = upper('&1')
union
select c.constraint_name,c.r_constraint_name cname2,
c.table_name table1, r.table_name table2,
decode(c.status,'DISABLED','DISABLE',' ') status,
decode(c.delete_rule,'CASCADE',' on delete cascade ',' ')
delete_rule
from user_constraints c,
user_constraints r
where c.constraint_type='R' and
c.r_constraint_name = r.constraint_name and
r.table_name = upper('&1');
cname varchar2(50);
cname2 varchar2(50);
cursor c2 is
select decode(position,1,'(',',')||rpad(column_name,40) colname
from user_cons_columns
where constraint_name = cname
order by position;
cursor c3 is
select decode(position,1,'(',',')||rpad(column_name,40) refcol
from user_cons_columns
where constraint_name = cname2
order by position;
begin
dbms_output.enable(100000);
for q1 in c1 loop
cname := q1.constraint_name;
cname2 := q1.cname2;
dbms_output.put_line('alter table '||q1.table1||' add constraint ');
dbms_output.put_line(cname||' foreign key');
for q2 in c2 loop
dbms_output.put_line(q2.colname);
end loop;
dbms_output.put_line(') references '||q1.table2);
for q3 in c3 loop
dbms_output.put_line(q3.refcol);
end loop;
dbms_output.put_line(') '||q1.delete_rule||q1.status);
dbms_output.put_line('/');
end loop;
end;
col c1 format a79 word_wrap
set long 32000
set arraysize 1
select 'create or replace trigger ' c1,
description c1,
'WHEN ('||when_clause||')' c1,
trigger_body ,
'/' c1
from user_triggers
where table_name = upper('&1') and when_clause is not null
select 'create or replace trigger ' c1,
description c1,
trigger_body ,
'/' c1
from user_triggers
where table_name = upper('&1') and when_clause is null
select 'alter trigger '||trigger_name||decode(status,'DISABLED','
DISABLE',' ENABLE')
from user_Triggers where table_name='&1';
set serveroutput on
declare
cursor c1 is
select 'alter table
'||'&1'||decode(substr(constraint_name,1,4),'SYS_',' ',
' add constraint ') a1,
decode(substr(constraint_name,1,4),'SYS_','
',constraint_name)||' check (' a2,
search_condition a3,
') '||decode(status,'DISABLED','DISABLE','') a4,
'/' a5
from user_constraints
where table_name = upper('&1') and
constraint_type='C';
b1 varchar2(100);
b2 varchar2(100);
b3 varchar2(32000);
b4 varchar2(100);
b5 varchar2(100);
fl number;
begin
open c1;
loop
fetch c1 into b1,b2,b3,b4,b5;
exit when c1%NOTFOUND;
select count(*) into fl from user_tab_columns where table_name =
upper('&1') and
upper(column_name)||' IS NOT NULL' = upper(b3);
if fl = 0 then
dbms_output.put_line(b1);
dbms_output.put_line(b2);
dbms_output.put_line(b3);
dbms_output.put_line(b4);
dbms_output.put_line(b5);
end if;
end loop;
end;
create or replace procedure dumzxcvreorg_dep(nam varchar2,typ
varchar2) as
cursor cur is
select type,decode(type,'PACKAGE BODY','PACKAGE',type) type1,
name from user_dependencies
where referenced_name=upper(nam) and referenced_type=upper(typ);
begin
dbms_output.enable(500000);
for c in cur loop
dbms_output.put_line('alter '||c.type1||' '||c.name||' compile;');
dumzxcvreorg_dep(c.name,c.type);
end loop;
end;
exec dumzxcvreorg_dep('&1','TABLE');
drop procedure dumzxcvreorg_Dep;
select 'grant '||privilege||' on '||table_name||' to '||grantee||
decode(grantable,'YES',' with grant option;',';') from
user_tab_privs where table_name = upper('&1');
select 'grant '||privilege||' ('||column_name||') on &1 to
'||grantee||
decode(grantable,'YES',' with grant option;',';')
from user_col_privs where grantor=user and
table_name=upper('&1')
order by grantee, privilege;
select 'create synonym '||synonym_name||' for
'||table_owner||'.'||table_name||';'
from user_synonyms where table_name=upper('&1');
PROMPT REM
PROMPT REM YOU MAY HAVE TO LOG ON AS SYSTEM TO BE
PROMPT REM ABLE TO CREATE ANY OF THE PUBLIC SYNONYMS!
PROMPT REM
select 'create public synonym '||synonym_name||' for
'||table_owner||'.'||table_name||';'
from all_synonyms where owner='PUBLIC' and table_name=upper('&1') and
table_owner=user;
prompt spool off
spool off
set echo on feed on verify on
The scripts REORGS1.SQL and REORGS2.SQL have been
created. Alter these script as necesarry.
To recreate the table-structure, first run REORGS1.SQL.
This script saves the content of your table in a table
called bk_.
If this script runs successfully run REORGS2.SQL.
The result is spooled to REORGTB.LST.
Check this file before dropping the bk_ table.
*/Please do NOT cross-postings: create a deep structure for dynamic internal table
Regards
Uwe -
Cranpkg - script for installing R libraries
Hi everyone,
I have created a script for installing R libraries using pacman. You can download it at http://allan.mcrae.googlepages.com/cranpkg (currently v0.3.0).
For example, the "genetics" library is installed using
> cranpkg -i genetics
CRANPKG v0.2
Copyright (C) 2007 Allan McRae
Examining R installation...
Installing package genetics...
Downloading package information...
Version: 1.3.0
Dependancies: combinat gdata gtools MASS mvtnorm
Resolving dependancies...
Installing combinat...
Installing gdata...
Installing mvtnorm...
Downloading package source...
Building package...
Installing package...
Done
> pacman -Qs cran
local/cran-combinat 0.0.6-1
R library - combinat. Built with cranpkg
local/cran-gdata 2.3.1-1
R library - gdata. Built with cranpkg
local/cran-genetics 1.3.0-1
R library - genetics. Built with cranpkg
local/cran-gtools 2.4.0-1
R library - gtools. Built with cranpkg
local/cran-mvtnorm 0.8.1-1
R library - mvtnorm. Built with cranpkg
This should be fairly robust against failures and leave log files in /tmp/cranpkg if anything fails. Please let me know if you run into trouble with this.
There a a few variables that you may need to modify at the top of the script. For example, the mirror you wish to download from.
Wget is used by default for the downloading and package installation is done with a "sudo pacman" command.
Any problems/success please let me know.
Last edited by Allan (2007-12-31 04:51:27)Here is some information on cranpkg status at v0.2:
Installs and loads fine in R:
adegenet, allelic, ape, bayesSurv, classifly, coda, combinat, e1071, gdata, gee, genetics, glpk, gstat, gtools, HardyWeinberg, kinship, mcmc, mvtnorm, nortest, qtl, reshape, RGtk2, smoothSurv, sp, tree.
Installs but fails to load in R:
graph, rggobi
Thats greater than 90% success rate... The packages that fail to load have no files in them (pacman -Ql <pkg> returns nothing).
Update: graph requires R>=2.6.0 (latest) which hasn't made it to Arch yet. rggobi require external software called ggobi so fails. These errors are caught in v0.2.1.
Last edited by Allan (2007-10-20 15:13:57) -
How to create IDOC for customer defined table
hi,
How to create IDOC for customer defined table Records and how to send this IDOC to target system.
what message type will be used and on receiving system how to post these records.
thankx.
pillac.Hi,
You need to create a custom message type and custom IDOC type for this with whatever fields you want send. You need to create segments (WE30), IDOC type (WE30), Message types (WE81) and assign the message type to the IDOC type (WE82).
You will have trigger the IDOC using a Report or something after doing the partner profile settings.
Similary in the target system also, you will have do all the settings.
Take a look the links to find out what settings needs to be done.
http://help.sap.com//saphelp_470/helpdata/EN/0b/2a611c507d11d18ee90000e8366fc2/frameset.htm
http://www.sappro.com/downloads/OneClientDistribution.pdf
Regards,
Ravi
Note : Please mark the helpful answers and close the thread if the issue is resolved. -
Where can I find the script for the sample table?
Hi,
Where can I find the script for the sample tables, like emp, dept, ... ?
Regards,
Rosalinehttp://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/appdev.817/a77069/preface.htm#420431
Hi,
Where can I find the script for the sample tables, like emp, dept, ... ?
Regards,
Rosaline -
Not able to push batch script for installing IIS all features using SCCM 2012 task sequence
Hey Guys, I am working for this from a long time but not able to make it work, I am using following batch script for installing IIS using SCCM 2012 task sequence:
Dism.exe /online /Enable-Feature /FeatureName:IIS-WebServerRole /FeatureName:IIS-WebServerRole /FeatureName:IIS-WebServer /FeatureName:IIS-ApplicationDevelopment /FeatureName:IIS-Security /FeatureName:IIS RequestFiltering /FeatureName:IIS-NetFxExtensibility
/FeatureName:WAS-WindowsActivationService /FeatureName:WAS-ProcessModel /FeatureName:WAS-NetFxEnvironment /FeatureName:WAS-ConfigurationAPI /FeatureName:NetFx3 /FeatureName:WCF-HTTP-Activation /FeatureName:WCF-NonHTTP-Activation /FeatureName:IIS-WebServerManagementTools
/FeatureName:IIS-ManagementConsole /FeatureName:IIS-ManagementScriptingTools /FeatureName:IISIIS6ManagementCompatibility /FeatureName:IIS-ManagementService /FeatureName:IIS-Metabase /FeatureName:IIS-WMICompatibility
When I run this script as admin by right click on it and select "run as a administrator" the script works fine but when I pushed the script as a software package or a step in OSD task sequence, nothing happens. I also tried
run command line option but no luck. Please help me with this.
Thanks,
VST1. When I used "run command line" option I found following errors in smsts.log:
Remediation failed. Code 8027000C TSManager 1/2/2014 2:32:12 PM 2720 (0x0AA0)
Remediation failed with error code 8027000C TSManager 1/2/2014 2:32:12 PM 2720 (0x0AA0)
Remediation failed. Code 8027000C TSManager 1/2/2014 2:34:16 PM 2092 (0x082C)
Remediation failed with error code 8027000C TSManager 1/2/2014 2:34:16 PM 2092 (0x082C)
Failed to run the action: Run Command Line.
Unknown error (Error: 800F080C; Source: Unknown) TSManager 1/2/2014 2:34:32 PM 2092 (0x082C)
Failed to delete directory 'C:\_SMSTaskSequence' TSManager 1/2/2014 2:34:33 PM 2092 (0x082C)
SetNamedSecurityInfo() failed. TSManager 1/2/2014 2:34:33 PM 2092 (0x082C)
SetObjectOwner() failed. 0x80070005. TSManager 1/2/2014 2:34:33 PM 2092 (0x082C)
RemoveFile() failed for C:\_SMSTaskSequence\TSEnv.dat. 0x80070005. TSManager 1/2/2014 2:34:33 PM 2092 (0x082C)
RemoveDirectoryW failed (0x80070091) for C:\_SMSTaskSequence TSManager 1/2/2014 2:34:33 PM 2092 (0x082C)
Failed to delete registry value HKLM\Software\Microsoft\SMS\Task Sequence\Package. Error code 0x80070002 TSManager 1/2/2014 2:34:33 PM 2092 (0x082C)
RegQueryValueExW failed for Software\Microsoft\SMS\Task Sequence, SMSTSEndProgram TSManager 1/2/2014 2:34:34 PM 2092 (0x082C)
GetTsRegValue() failed. 0x80070002. TSManager 1/2/2014 2:34:34 PM 2092 (0x082C)
ReleaseRequest failed with error code 0x80004005 TSManager 1/2/2014 2:34:34 PM 2092 (0x082C)
RegQueryValueExW failed for Software\Microsoft\SMS\Task Sequence, SMSTSEndProgram OSDSetupHook 1/2/2014 2:34:35 PM 360 (0x0168)
GetTsRegValue() failed. 0x80070002. OSDSetupHook 1/2/2014 2:34:35 PM 360 (0x0168)
2. We are not using MDT in our environment so I ant use add features and roles option.
3. The script is running fine when we run it manually. -
Want to take "CREATE script" for all roles existing in DB.
Hi All,
I want to take "CREATE script" for all roles existing in DB.
Please provide me script to generate if you have or suggest any link or doc.
Oracle 10GUse this-
select 'select dbms_metadata.get_ddl(''ROLE'','''||ROLE||''')||chr(10)||''/'' from dual;'
from dba_roles
Please be aware grants will not come in the definition
If you like the answer then don't forget to give points -
Installation script for installing tables
I am trying to create a packaged application .(package include app, themes, images , shared components and underlying tables)
something similar to the lines of package application samples available here
http://www.oracle.com/technology/products/database/application_express/packaged_apps/packaged_apps.html
Please let me know if there is a way to create installation scripts for tables+sequences+triggers+data.
Appreciate itThese are MS Windows patches, say for server 2012.
this is a simple batch file am using for monthly patches. But now there are servers in staging area of DC which are required to patch with all missing patches from last 1year or so. We got all the patches in to a folder, and need to run against each server.
================================
SC QUERY state= all | findstr "DISPLAY_NAME | STATE" > C:\Services_Before_Reboot_Dec_14.txt
# will grab service beofore reboot
Windows8.1-KB2992611-x64.msu /quiet /norestart
Windows8.1-KB3008923-x64.msu /quiet /norestart
Windows8.1-KB3011780-x64.msu /quiet /norestart
Windows8.1-KB3013126-x64.msu /quiet /norestart
Pause
===================
Cheers, Ramakrishna Darla. -
Create view for Global Temporary Table
if view is create for global temporary table so exactly how it works which helps regarding application performance.
Regaards,
Sambit RayA view is just a stored query. It can be on global temporary tables or regular one, makes no difference.
-
Write-Progress in PowerShell script for installing Missing Updates
Hi, I had a previous question here
https://social.technet.microsoft.com/Forums/windowsserver/en-US/88931488-3b2c-4c08-9ad3-6651ba9bbcef/action?threadDisplayName=progress-indicator-for-installing-missing-sccm-2012-r2-updates
But that method is not working as expected. The progress bar displays then continues to increment past 100 throwing an error each time.
I'm thinking I could use a foreach loop for the missing updates but I'm just lost when it comes to Powershell syntax.
For example:
# Get the number of missing updates
[System.Management.ManagementObject[]] $CMMissingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE ComplianceState = '0'" -namespace "ROOT\ccm\ClientSDK") #End Get update count.
$result.UpdateCountBefore = "The number of missing updates is $($CMMissingUpdates.count)"
#Install missing updates.
#Begin example code, not tested.
Foreach ($update in $CMMissingUpdates)
$i++
If ($CMMissingUpdates.count) {
$CMInstallMissingUpdates = (GWMI -ComputerName $server -Namespace "root\ccm\clientsdk" -Class "CCM_SoftwareUpdatesManager" -List).InstallUpdates($CMMissingUpdates)
Do {
Start-Sleep -Seconds 15
[array]$CMInstallPendingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE EvaluationState = 6 or EvaluationState = 7" -namespace "ROOT\ccm\ClientSDK")
#end my example code.
#The code below is working to install updates but Write-Progress isn't.
If ($CMMissingUpdates.count) {
#$result.UpdateCountBefore = "The number of missing updates is $($CMMissingUpdates.count)"
$CMInstallMissingUpdates = (GWMI -ComputerName $server -Namespace "root\ccm\clientsdk" -Class "CCM_SoftwareUpdatesManager" -List).InstallUpdates($CMMissingUpdates)
#Set the missing updates to variable for progress indicator.
$updates = $CMMissingUpdates.Count
$Increment = 100 / $updates
$Percent = 0
Do {
Start-Sleep -Seconds 15
[array]$CMInstallPendingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE EvaluationState = 6 or EvaluationState = 7" -namespace "ROOT\ccm\ClientSDK")
#Not 100% sure $result.UpdateCountBefore is needed below.
$result.UpdateCountBefore = "The number of pending updates for installation is: $($CMInstallPendingUpdates.count)"
Write-Progress -Activity "Updates are installing..." -PercentComplete $Percent -Status "Working..."
$Percent = $Percent + $Increment
} While (($CMInstallPendingUpdates.count -ne 0) -and ((New-TimeSpan -Start $StartTime -End $(Get-Date)) -lt "00:45:00"))
Write-Progress -Activity "Updates Installed" -Status "Done" -Completed
} ELSE {
$result.UpdateCountAfter = "There are no missing updates."}
$resultThe increment should be 100 / (max number of items)
That will not exceed 100 through (max number of items ) iterations in a loop
Mathematically that can be written as
100 / (Max Number of items) * (max number of items ) iterations in a loop
= 100 * ( (Max Number of Item) / (Number Iterations in a loop) )
= 100 * 1 = 100
The (max number of items) and (Number of Iterations in a loop ) need to be based on the same number.
In the script, it is not based on the same number.
The maximum number of items is $CMMissingUpdates.Count
The number of iterations in the loop is based on the condition
($CMInstallPendingUpdates.count -ne 0)
Which causes the iterations of the loop to exceed $CMMissingUpdates.Count
Assuming the $CMInstallPendingUpdates.count is going down (is decremented) through the loop, then
$Increment = 100 /
$CMInstallPendingUpdates.count -
Need help creating script for specific instance
I am having trouble coming up with a working script for this part of the pricing form I am editing. I am trying to get the calculation fields to the right to change and populate in the respective field based on the selection in the Material Type dropdown. Would it be less of a headache if I made another text field to calculate the LE versions separately instead of trying to merge them into one field? I have attached screenshots below to give you an example of what I'm working with. Any help with this is greatly appreciated!
Script I'm tinkering with at the moment:
//Dropdown37 = Quantity Field
//Type of Door IB = Material Type dropdown
var x = this.getField("Type of Door IB").value;
if ( x = 1468 ) event.value = x * this.getField("Dropdown37").value;
if (x = 1202) event.value = x * this.getField("Dropdown37").value;
else event.value = 0;The comparison operator in JS is "==", so change this line:
if ( x = 1468 )
To this:
if ( x == 1468 )
(as well as the other if-statement). -
Creating index for a big table
Hello,
We have Oracle 9.2
I have two tables TableA and TableB. TableB is created by copying part of the content of TableA. Inorder to speed up the coping process, I dropped the primary index of TableB. Now TableB has 94 million records.
Now I was trying to create the primary index for TableB with the following script:
CREATE UNIQUE INDEX USR3."TableB~0"
ON USR3.TableB(ID,COUNTER)
PCTFREE 10
INITRANS 2
MAXTRANS 255
TABLESPACE INDEX1
STORAGE(FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT)
LOGGING
NOPARALLEL
NOCOMPRESS
And I get the Oracle catch all error (ora-00600: internal error....)
And I only have the following error message: "kcbvmap: unable to find victim buffer"
The tablespace is a locally managed tablespace
Please help, how do I fix this problem.CREATE UNIQUE INDEX USR3."TableB~0"
What's with the wacky name? -
Script for Compare same table 'TAB1' structures in different schemas
Hello, i am having three schema and in all schema i have same table for example TAB1 and i want to Compare TAB1 table structures in all three schema but i don't know the script. the different should content at least DATA_TYPE,DATA_LENGTH,DECODE(DATA_PRECISION,NULL,NULL,DATA_PRECISION||','||DATA_SCALE) columns in query. Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi Thanks..
If you want a generic script use below function to get the difference.. Run the below script and let me know in case of any issues
CREATE OR REPLACE TYPE nt_username IS TABLE OF VARCHAR2(50);
CREATE OR REPLACE TYPE obj_struc IS OBJECT (user_name1 VARCHAR2(30),
user_name2 VARCHAR2(30),
column_name1 VARCHAR2(30),
column_name2 VARCHAR2(30),
data_type1 VARCHAR2(106),
data_type2 VARCHAR2(106),
data_length1 NUMBER(10),
data_length2 NUMBER(10),
data_precision1 VARCHAR2(50),
data_precision2 VARCHAR2(50),
column_id1 NUMBER(10),
column_id2 NUMBER(10)
CREATE OR REPLACE TYPE nt_struc IS TABLE OF obj_struc;
CREATE OR REPLACE FUNCTION tabstruc_script (p_tabnm VARCHAR2,
p_usernm nt_username
RETURN nt_struc
AS
v_nt_struc nt_struc := nt_struc();
v_ntusrnm nt_username := p_usernm;
TYPE rec_stru IS RECORD (column_name all_tab_columns.column_name%TYPE,
data_type all_tab_columns.data_type%TYPE,
data_length all_tab_columns.data_length%TYPE,
data_precision all_tab_columns.data_precision%TYPE,
data_scale all_tab_columns.data_scale%TYPE,
column_id all_tab_columns.column_id%TYPE
TYPE nt_stru IS TABLE OF rec_stru;
v_ntstru nt_stru := nt_stru();
v_columnname all_tab_columns.column_name%TYPE;
v_reccnt NUMBER;
v_cnt NUMBER;
v_precision1 VARCHAR2(50);
v_precision2 VARCHAR2(50);
BEGIN
FOR i IN 1..v_ntusrnm.COUNT
LOOP
SELECT COUNT(*) INTO v_reccnt
FROM all_tables
WHERE owner = v_ntusrnm(i)
AND table_name = p_tabnm;
IF v_reccnt >= 1 THEN
SELECT column_name,
data_type,
data_length,
data_precision,
data_scale,
column_id
BULK COLLECT INTO v_ntstru
FROM all_tab_columns
WHERE owner = v_ntusrnm(i)
AND table_name = p_tabnm;
FOR j IN i+1..v_ntusrnm.COUNT
LOOP
FOR k IN 1..v_ntstru.COUNT
LOOP
SELECT COUNT(*) INTO v_cnt
FROM all_tab_columns
WHERE owner = v_ntusrnm(j)
AND table_name = p_tabnm
AND column_name = v_ntstru(k).column_name;
IF v_cnt >= 1 THEN
FOR l IN (SELECT column_name,
data_type,
data_length,
data_precision,
data_scale,
column_id
FROM all_tab_columns
WHERE owner = v_ntusrnm(j)
AND table_name = p_tabnm
AND column_name = v_ntstru(k).column_name)
LOOP
IF ((v_ntstru(k).column_id <> l.column_id)
OR (v_ntstru(k).data_type <> l.data_type)
OR (NVL(v_ntstru(k).data_length,0) <> NVL(l.data_length,0))
OR (NVL(v_ntstru(k).data_precision,0) <> NVL(l.data_precision,0))
OR (NVL(v_ntstru(k).data_scale,0) <> NVL(l.data_scale,0))) THEN
v_nt_struc.EXTEND;
SELECT DECODE(v_ntstru(k).data_precision,NULL,NULL,v_ntstru(k).data_precision||','||v_ntstru(k).data_scale),
DECODE(l.data_precision,NULL,NULL,l.data_precision||','||l.data_scale)
INTO v_precision1,
v_precision2
FROM DUAL;
v_nt_struc(v_nt_struc.COUNT) := obj_struc(v_ntusrnm(i),
v_ntusrnm(j),
v_ntstru(k).column_name,
l.column_name,
v_ntstru(k).data_type,
l.data_type,
v_ntstru(k).data_length,
l.data_length,
v_precision1,
v_precision2,
v_ntstru(k).column_id,
l.column_id);
END IF;
END LOOP;
END IF;
END LOOP;
FOR m IN(SELECT column_name,
data_type,
data_length,
data_precision,
data_scale,
column_id
FROM all_tab_columns
WHERE owner = v_ntusrnm(i)
AND table_name = p_tabnm
AND column_name NOT IN(SELECT column_name
FROM all_tab_columns
WHERE owner = v_ntusrnm(j)
AND table_name = p_tabnm))
LOOP
v_nt_struc.EXTEND;
SELECT DECODE(m.data_precision,NULL,NULL,m.data_precision||','||m.data_scale)
INTO v_precision1
FROM DUAL;
v_nt_struc(v_nt_struc.COUNT) := obj_struc(v_ntusrnm(i),
v_ntusrnm(j),
m.column_name,
NULL,
m.data_type,
NULL,
m.data_length,
NULL,
v_precision1,
NULL,
m.column_id,
NULL);
END LOOP;
FOR n IN(SELECT column_name,
data_type,
data_length,
data_precision,
data_scale,
column_id
FROM all_tab_columns
WHERE owner = v_ntusrnm(j)
AND table_name = p_tabnm
AND column_name NOT IN(SELECT column_name
FROM all_tab_columns
WHERE owner = v_ntusrnm(i)
AND table_name = p_tabnm))
LOOP
v_nt_struc.EXTEND;
SELECT DECODE(n.data_precision,NULL,NULL,n.data_precision||','||n.data_scale)
INTO v_precision2
FROM DUAL;
v_nt_struc(v_nt_struc.COUNT) := obj_struc(v_ntusrnm(j),
v_ntusrnm(i),
n.column_name,
NULL,
n.data_type,
NULL,
n.data_length,
NULL,
v_precision2,
NULL,
n.column_id,
NULL);
END LOOP;
END LOOP;
END IF;
END LOOP;
RETURN v_nt_struc;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END tabstruc_script;
SELECT * FROM TABLE(tabstruc_script(:tabnm,nt_username(:user1,:user2,:user3)));
You need to pass tablename and username to calling this function. Username is a nested table here so you can pass like nt_username(:user1,:user2,:user3) -
Archwiz Script for installing Arch Linux
I created a new Bash Script Project called Archwiz, located on github flesh/archwiz ,
its still in Beta for a few reasons, I never figured out how to get computer translations working in the script so I can Localize it, and I never figured out all the details to get an AUR custom repo working and lastly I didn't get the Asynchronous downloads to work right, so there are all disabled in this script.
This script was a fork of another script found here Archlinux Ultimate Install Script.
The Script itself has several files, the wizard.sh is a library, that allow programmers to use this library as an API for writing scripts, so its usefully to anyone that wants an API to write Bash Scripts, but the script itself scripts a script that is saved as configuration files, then executes the script inside itself, so you can look at all the configuration files before running it.
The script was written for use by anyone, but mostly targets programmers like myself who need to setup a machine to use as a work station and want it set up a certain way every time, although this script is far from finished, I have a lot of tweaking to do to it before it would be completely there, but as it is, I can get up and running on a machine with little effort, so this make it ideal for a Linux Administrator who has to install thousands of OS's and have them configured all the same way, but works great for someone just wanting to install Arch Linux.
The Project is Self Documenting and Self Localizing, although currently only English works, but the po files are there, so it would be easy enough if you wanted to localize it; but the computer translation function I started would be the correct way to do this.
The scripts makes use of a custom repo, so remove it when finished, the script should do this for you, but just to let you know, it downloads the core to the flash drive, this way it can install very fast, once you install it one, it has all the files on it to install on another computer without an Internet connection, well at least that was my thinking, I never did get the AUR custom repo to work, but the idea is to have all the files on the flash so you do not need to use up bandwidth installing Arch Linux on a new machine, just install it, then run pacman updates.
The Idea of a Wizard is to make the life of those installing an OS, much easier, they have the Option to do a Custom install, or a Wizard install, even an Automatic install to pre-configure machines.
The script determines if you have UEFI Bios or not, and formats and configures the Hard Drive correctly, and gives you full control over the partitioning of the drive, within the bounds of the tools used, so its very flexible, it uses systemd, so boot time on my machine is 10 seconds flat, and that's because I mount a lot of network drives and map them at boot time, I got 2 seconds boot time with mounting, so the packages are not perfect, but they do work.
I only tested GDM, since I installed every Desktop Manager and configuration for my needs, this was the only one I got to work for all of them, but I normally use KDE or Mate, but I ran into issues with Mate and went back to KDE, so I could get back to work.
This script was designed to Format the Drive you install it to, so do not use this on a Partitioned Drive, it will format the hard drive, so you are warned once more during the install, but this could be fixed, I had to abandon the project to finish another, so the script is as it is, but could give someone a great start if they want to folk it and finish it, so fork me.
See the help.html for details.
Last edited by Flesh (2013-02-28 00:31:54)Moving to Community Contributions...
-
How can I use create/createInsert for two different tables
Hi All,
I am showing different fields in the UI from different tables. I am able to fetch the data from all the tables and able to modify and save the data.
Now, the problem when I want to create/insert some data into those columns(from different tables) I am facing issues.
How can I proceed further??Hi Shay,
Thank you very much for your quick response.
Actually I am totally new in ADF world and I am trying to implement some applications in ADF.
I created an UI based on some 3 tables(there is foreign key relation between them) and some other tables. I am able to modify and save my application if there is any data in all the tables.
My Actual issues are
1) I removed all the data from the tables. There is a submit(CreateInsert) button, what I expected is on click of the button I should see all the fields in editable mode. But I was able to see only few fields and also in readonly mode. So here my issue is how can i create and save these data.
2) Consider on my landing page I have just CommandLink/CommandButton. After clicking that page I should get the above screen in create mode(I mean to say all fields in editable mode). How can achieve this?
Thanks & Regards,
Ravi.
Maybe you are looking for
-
790FX-GD70 not setting RAM to correct timing nor voltage from SPED
My 790FX-GD70 not setting RAM to correct timing nor voltage from SPED when set to auto. The RAM I have should be 6 6 6 20 @ 1.8V but the motherboard is setting it to 9 9 9 24 @ 1.5 V The RAM is Crucial 2GB, Ballistix 240-pin DIMM, DDR3 PC3-10600 me
-
My daughter has changed her ipod touch password and it will not allow her to put in letters so therefore she is locked out! How can she fix this?
-
Procedure for Mapping two types of Idocs from RFC function Module
Hi My Scenario is RFC -- XI -- IDOC Here i have 2 custom Idocs First IDOC for Creation second is for Deletion/Changing Based on the condition from RFC it should trigger either one of the IDOC above. Please provide me the procedure to do in IR and ID.
-
Adobe apps funky in 10.4.6
I recently did an erase and reinstall to work around the bug in which the QT 7.0.4 update invalidates the QT Pro key... Anyway, so now I have 10.4.6 on my machine, my system and all the apps are only a few days old. I use Photoshop and Illustrator a
-
Dear All, kindly give me the details for transporting SAP Querry from Development to Production.. Whether we can create any request for this?? Thanks in Advance, Regards, Lijo