Create script from wmi

I would like to create a script in wmi that will compare the serial number pulled from the bios and compare that to a filed in a csv file and create 2 fields in the registry, so when a inventory runs it will place adf defined fields in the workstation inventory. I have two scripts that will read wmi and one that will write the registry but dont know how to get them to talk to each other and search a file with two fields.
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("localhost")
For Each strComputer In arrComputers
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
strBiosCharacteristics = Join(objItem.BiosCharacteristics, ",")
WScript.Echo "SERIAL=" & objItem.SerialNumber
WScript.Echo
Next
Next
Dim WshShell, bKey
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKLM\Software\lewisclark\WSNUM", "123", "REG_SZ"

MGLASS,
It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.
Has your problem been resolved? If not, you might try one of the following options:
- Visit http://support.novell.com and search the knowledgebase and/or check all
the other self support options and support programs available.
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://forums.novell.com)
Be sure to read the forum FAQ about what to expect in the way of responses:
http://forums.novell.com/faq.php
If this is a reply to a duplicate posting, please ignore and accept our apologies
and rest assured we will issue a stern reprimand to our posting bot.
Good luck!
Your Novell Product Support Forums Team
http://support.novell.com/forums/

Similar Messages

  • How can I create scripts from DBA studio??

    I just created about a bunch of tables, F&P keys, synonyms, etc using DBA studio. Now I'd like to extract that dictionary data to create scripts that I can run in the future to recreate the environment in production.
    How can I do this?
    THanks,
    Chris

    For some reason in my Oracle DBA Studio ( Oralce 8.1.6) table right click menu has no "Show object DDL" option. I run DBA Studio standalone, not from Oracle Enterpr Manager. Can this be the reason ?
    Also my database has 100+ tables.
    I also tried the import with indexfile option. It is gives me all a lot of ALTERs as they where applied to tables which looks UGLY. I need "clean" CREATE TABLE DDL.
    I's amaizing that Oracle has no simple way of doing this ???

  • Create script from another script using PROMPT

    Oracle 11
    Instead of having to link to another database I want to create 2 scripts that are executed from a shell script and run them separately. Script1 run in Database1 would create Script 2 by using PROMPT to create the second script while grabbing a date from database1 to pass into database2. I almost have it but the problem is ... Script2 uses COPY FROM and I have to put a "-" at the end of each line which the PROMPT takes as a literal instead of as part of the output.
    SCRIPT1:
    set pagesize 0
    set trimspool on
    set linesize 2000
    set echo off
    set verify off
    set feedback off
    set sqlblanklines on
    spool /home/michelle/sql_scripts/sl_dtc_copy2.sql
    PROMPT whenever sqlerror exit sql.sqlcode rollback
    PROMPT SET ARRAYSIZE 5000
    PROMPT SET COPYCOMMIT 20
    PROMPT set linesize 4000
    PROMPT
    PROMPT COPY FROM {username}/{pswd}@{DB2}  TO {username}/{pswd}@{DB2}
    PROMPT CREATE SL_DTC_TMP USING SELECT DISTINCT
    PROMPT col1, col2, col3
    PROMPT FROM dual
    PROMPT WHERE veh_data_elements_cd = 'ODO_READ'
    PROMPT and       dh.data_collected_timstm >= 
    select trunc(sysdate)-7 from dual;
    PROMPT and       substr(vdh.vin,10,1) in ('A','B','C','D')
    PROMPT /
    PROMPT spool off
    PROMPT exit
    spool off
    exitSCRIPT2 NOW:
    whenever sqlerror exit sql.sqlcode rollback
    SET ARRAYSIZE 5000
    SET COPYCOMMIT 20
    set linesize 4000
    COPY FROM {username}/{pswd}@{DB2}  TO {username}/{pswd}@{DB2}
    CREATE SL_DTC_TMP USING SELECT DISTINCT
    col1, col2, col3
    FROM dual
    WHERE veh_data_elements_cd = 'ODO_READ'
    and       dh.data_collected_timstm >=
    12-AUG-11
    and       substr(vdh.vin,10,1) in ('A','B','C','D')
    spool off
    exitSCRIPT2 HOW IT NEEDS TO BE:
    --- A [SPACE] AND A [-] at the end of each line
    --- THE DATE NEEDS TO HAVE SINGLE QUOTES AND PREFERABLY AT THE END OF THE PREVIOUS LINE
    whenever sqlerror exit sql.sqlcode rollback
    SET ARRAYSIZE 5000
    SET COPYCOMMIT 20
    set linesize 4000
    COPY FROM {username}/{pswd}@{DB2}  TO {username}/{pswd}@{DB2} -
    CREATE SL_DTC_TMP USING SELECT DISTINCT -
    col1, col2, col3 -
    FROM dual -
    WHERE veh_data_elements_cd = 'ODO_READ' -
    and       dh.data_collected_timstm >= '12-AUG-11' -
    and       substr(vdh.vin,10,1) in ('A','B','C','D')
    spool off
    exitTHANK YOU

    Try
    select 'whenever sqlerror exit sql.sqlcode rollback'                    ||chr(10)||
           'SET ARRAYSIZE 5000'                                             ||chr(10)||
           'SET COPYCOMMIT 20'                                              ||chr(10)||
           'set linesize 4000'                                              ||chr(10)||
           ' '                                                              ||chr(10)||
           'COPY FROM {username}/{pswd}@{DB2}  TO {username}/{pswd}@{DB2} -'||chr(10)||
           'CREATE SL_DTC_TMP USING SELECT DISTINCT -'                      ||chr(10)||
           'col1, col2, col3 -'                                             ||chr(10)||
           'FROM dual -'                                                    ||chr(10)||
           'WHERE veh_data_elements_cd = ''ODO_READ'' -'                    ||chr(10)||
           'and       dh.data_collected_timstm >= ''12-AUG-11'' -'          ||chr(10)||
           'and       substr(vdh.vin,10,1) in (''A'',''B'',''C'',''D'')'
           as Script
    from dual

  • How Retrive all the scripts from dump?

    Hi All,
    I have a dump with me which is taken from Oracle 10g.
    I need to get some of the procedures and functions from that Dump, Is there any way to create scripts from that dump.
    Kindly help me out in this.
    Thanks
    Regards
    Gatha

    HI .. MY HR USER IS HAVING SOME PROCEDURES AND FUNCTIONS , But in the indexfile iam not getting it..
    SQL> select object_name,owner from dba_objects where object_type In ('PROCEDURE','FUNCTION') AND OWNE
    OBJECT_NAME
    OWNER
    SECURE_DML
    HR
    ADD_JOB_HISTORY
    HR
    EMP_SEL
    HR
    OBJECT_NAME
    OWNER
    TDEST_INSERT
    HR
    SQL> HOST EXP HR/HR FILE=C:\EXPHR.DMP LOG=EXP.LOG FULL=Y
    Export: Release 10.2.0.1.0 - Production on Tue Feb 3 12:12:43 2009
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    EXP-00023: must be a DBA to do Full Database or Tablespace export
    (2)U(sers), or (3)T(ables): (2)U >
    EXP-00030: Unexpected End-Of-File encountered while reading input
    EXP-00000: Export terminated unsuccessfully
    SQL> HOST EXP HR/HR FILE=C:\EXPHR.DMP LOG=EXP.LOG
    SQL> HOST EXP HR/HR FILE=C:\EXPHR.DMP LOG=C:\EXP.LOG
    Export: Release 10.2.0.1.0 - Production on Tue Feb 3 12:13:05 2009
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    . exporting pre-schema procedural objects and actions
    . exporting foreign function library names for user HR
    . exporting PUBLIC type synonyms
    . exporting private type synonyms
    . exporting object type definitions for user HR
    About to export HR's objects ...
    . exporting database links
    . exporting sequence numbers
    . exporting cluster definitions
    . about to export HR's tables via Conventional Path ...
    . . exporting table COUNTRIES 25 rows exported
    . . exporting table DEPARTMENTS 27 rows exported
    . . exporting table EM 299 rows exported
    . . exporting table EMP 0 rows exported
    . . exporting table EMP1 107 rows exported
    . . exporting table EMPLOYEES 23 rows exported
    . . exporting table JOBS 19 rows exported
    . . exporting table JOB_HISTORY 10 rows exported
    . . exporting table LOCATIONS 23 rows exported
    . . exporting table REGIONS 4 rows exported
    . . exporting table SUBSCRIPTIONS 8 rows exported
    . . exporting table TDEST 89987 rows exported
    . . exporting table TRANSACTIONS 10 rows exported
    . . exporting table TRANSACTIONS_BACK 10 rows exported
    . . exporting table TSOURCE 9517 rows exported
    . . exporting table TSOURCE_BACK 9517 rows exported
    . . exporting table USERS 13 rows exported
    . exporting synonyms
    . exporting views
    . exporting stored procedures
    . exporting operators
    . exporting referential integrity constraints
    . exporting triggers
    . exporting indextypes
    . exporting bitmap, functional and extensible indexes
    . exporting posttables actions
    . exporting materialized views
    . exporting snapshot logs
    . exporting job queues
    . exporting refresh groups and children
    . exporting dimensions
    . exporting post-schema procedural objects and actions
    . exporting statistics
    Export terminated successfully without warnings.
    SQL> HOST IMP HR/HR FILE=C:\EXPHR.DMP LOG=C:\EXP.LOG SHOW=Y INDEXFILE=C:\SHOW.TXT
    Import: Release 10.2.0.1.0 - Production on Tue Feb 3 12:14:06 2009
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export file created by EXPORT:V10.02.01 via conventional path
    import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    . . skipping table "COUNTRIES"
    . . skipping table "DEPARTMENTS"
    . . skipping table "EM"
    . . skipping table "EMP"
    . . skipping table "EMP1"
    . . skipping table "EMPLOYEES"
    . . skipping table "JOBS"
    . . skipping table "JOB_HISTORY"
    . . skipping table "LOCATIONS"
    . . skipping table "REGIONS"
    . . skipping table "SUBSCRIPTIONS"
    . . skipping table "TDEST"
    . . skipping table "TRANSACTIONS"
    . . skipping table "TRANSACTIONS_BACK"
    . . skipping table "TSOURCE"
    . . skipping table "TSOURCE_BACK"
    . . skipping table "USERS"
    Import terminated successfully without warnings.
    contents of indexfile:
    REM CREATE TABLE "HR"."COUNTRIES" ("COUNTRY_ID" CHAR(2) CONSTRAINT
    REM "COUNTRY_ID_NN" NOT NULL ENABLE, "COUNTRY_NAME" VARCHAR2(40),
    REM "REGION_ID" NUMBER, CONSTRAINT "COUNTRY_C_ID_PK" PRIMARY KEY
    REM ("COUNTRY_ID") ENABLE ) ORGANIZATION INDEX PCTFREE 10 INITRANS 2
    REM MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1
    REM BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING NOCOMPRESS
    REM PCTTHRESHOLD 50 ;
    REM ... 25 rows
    REM CREATE TABLE "HR"."DEPARTMENTS" ("DEPARTMENT_ID" NUMBER(4, 0),
    REM "DEPARTMENT_NAME" VARCHAR2(30) CONSTRAINT "DEPT_NAME_NN" NOT NULL
    REM ENABLE, "MANAGER_ID" NUMBER(6, 0), "LOCATION_ID" NUMBER(4, 0))
    REM PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536
    REM FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE
    REM "EXAMPLE" NOLOGGING NOCOMPRESS ;
    REM ... 27 rows
    CONNECT HR;
    CREATE UNIQUE INDEX "HR"."DEPT_ID_PK" ON "DEPARTMENTS" ("DEPARTMENT_ID" )
    PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE INDEX "HR"."DEPT_LOCATION_IX" ON "DEPARTMENTS" ("LOCATION_ID" )
    PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    REM ALTER TABLE "HR"."DEPARTMENTS" ADD CONSTRAINT "DEPT_ID_PK" PRIMARY
    REM KEY ("DEPARTMENT_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    REM STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
    REM DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ENABLE ;
    REM CREATE TABLE "HR"."EM" ("EMPLOYEE_ID" NUMBER(6, 0), "FIRST_NAME"
    REM VARCHAR2(20), "LAST_NAME" VARCHAR2(25) NOT NULL ENABLE, "EMAIL"
    REM VARCHAR2(25) NOT NULL ENABLE, "PHONE_NUMBER" VARCHAR2(20),
    REM "HIRE_DATE" DATE NOT NULL ENABLE, "JOB_ID" VARCHAR2(10) NOT NULL
    REM ENABLE, "SALARY" NUMBER(8, 2), "COMMISSION_PCT" NUMBER(2, 2),
    REM "MANAGER_ID" NUMBER(6, 0), "DEPARTMENT_ID" NUMBER(4, 0)) PCTFREE 10
    REM PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    REM FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING
    REM NOCOMPRESS ;
    REM ... 299 rows
    REM CREATE TABLE "HR"."EMP" ("EMPLOYEE_ID" NUMBER(6, 0), "FIRST_NAME"
    REM VARCHAR2(20), "LAST_NAME" VARCHAR2(25) NOT NULL ENABLE, "EMAIL"
    REM VARCHAR2(25) NOT NULL ENABLE, "PHONE_NUMBER" VARCHAR2(20),
    REM "HIRE_DATE" DATE NOT NULL ENABLE, "JOB_ID" VARCHAR2(10) NOT NULL
    REM ENABLE, "SALARY" NUMBER(8, 2), "COMMISSION_PCT" NUMBER(2, 2),
    REM "MANAGER_ID" NUMBER(6, 0), "DEPARTMENT_ID" NUMBER(4, 0)) PCTFREE 10
    REM PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    REM FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING
    REM NOCOMPRESS ;
    REM ... 0 rows
    CREATE UNIQUE INDEX "HR"."EMP_EMP_ID_PK1" ON "EMP" ("EMPLOYEE_ID" )
    PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING ;
    CREATE INDEX "HR"."EMP_IDX" ON "EMP" ("JOB_ID" ) PCTFREE 10 INITRANS 2
    MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT) TABLESPACE "USERS" NOLOGGING PARALLEL ( DEGREE 5
    INSTANCES 1) ;
    REM ALTER TABLE "HR"."EMP" ADD CONSTRAINT "EMP_EMP_ID_PK1" PRIMARY KEY
    REM ("EMPLOYEE_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    REM STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
    REM DEFAULT) TABLESPACE "USERS" LOGGING ENABLE ;
    REM CREATE TABLE "HR"."EMP1" ("EMPLOYEE_ID" NUMBER(6, 0), "FIRST_NAME"
    REM VARCHAR2(20), "LAST_NAME" VARCHAR2(25) NOT NULL ENABLE, "EMAIL"
    REM VARCHAR2(25) NOT NULL ENABLE, "PHONE_NUMBER" VARCHAR2(20),
    REM "HIRE_DATE" DATE NOT NULL ENABLE, "JOB_ID" VARCHAR2(10) NOT NULL
    REM ENABLE, "SALARY" NUMBER(8, 2), "COMMISSION_PCT" NUMBER(2, 2),
    REM "MANAGER_ID" NUMBER(6, 0), "DEPARTMENT_ID" NUMBER(4, 0)) PCTFREE 10
    REM PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 1021313024
    REM FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS"
    REM LOGGING NOCOMPRESS ;
    REM ... 107 rows
    REM CREATE TABLE "HR"."EMPLOYEES" ("EMPLOYEE_ID" NUMBER(6, 0),
    REM "FIRST_NAME" VARCHAR2(20), "LAST_NAME" VARCHAR2(25) CONSTRAINT
    REM "EMP_LAST_NAME_NN" NOT NULL ENABLE, "EMAIL" VARCHAR2(25) CONSTRAINT
    REM "EMP_EMAIL_NN" NOT NULL ENABLE, "PHONE_NUMBER" VARCHAR2(20),
    REM "HIRE_DATE" DATE CONSTRAINT "EMP_HIRE_DATE_NN" NOT NULL ENABLE,
    REM "JOB_ID" VARCHAR2(10) CONSTRAINT "EMP_JOB_NN" NOT NULL ENABLE,
    REM "SALARY" NUMBER(8, 2), "COMMISSION_PCT" NUMBER(2, 2), "MANAGER_ID"
    REM NUMBER(6, 0), "DEPARTMENT_ID" NUMBER(4, 0)) PCTFREE 10 PCTUSED 40
    REM INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST
    REM GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING
    REM NOCOMPRESS ;
    REM ... 23 rows
    CREATE UNIQUE INDEX "HR"."EMP_EMAIL_UK" ON "EMPLOYEES" ("EMAIL" ) PCTFREE
    10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST
    GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE UNIQUE INDEX "HR"."EMP_EMP_ID_PK" ON "EMPLOYEES" ("EMPLOYEE_ID" )
    PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE INDEX "HR"."EMP_DEPARTMENT_IX" ON "EMPLOYEES" ("DEPARTMENT_ID" )
    PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE INDEX "HR"."EMP_JOB_IX" ON "EMPLOYEES" ("JOB_ID" ) PCTFREE 10
    INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS
    1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE INDEX "HR"."EMP_MANAGER_IX" ON "EMPLOYEES" ("MANAGER_ID" ) PCTFREE
    10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST
    GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE INDEX "HR"."EMP_NAME_IX" ON "EMPLOYEES" ("LAST_NAME" , "FIRST_NAME"
    ) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE INDEX "HR"."IND" ON "EMPLOYEES" ("SALARY" ) PCTFREE 10 INITRANS 2
    MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING ;
    REM ALTER TABLE "HR"."EMPLOYEES" ADD CONSTRAINT "EMP_SALARY_MIN" CHECK
    REM (salary > 0) ENABLE NOVALIDATE ;
    REM CREATE TABLE "HR"."JOBS" ("JOB_ID" VARCHAR2(10), "JOB_TITLE"
    REM VARCHAR2(35) CONSTRAINT "JOB_TITLE_NN" NOT NULL ENABLE, "MIN_SALARY"
    REM NUMBER(6, 0), "MAX_SALARY" NUMBER(6, 0)) PCTFREE 10 PCTUSED 40
    REM INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST
    REM GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING
    REM NOCOMPRESS ;
    REM ... 19 rows
    CREATE UNIQUE INDEX "HR"."JOB_ID_PK" ON "JOBS" ("JOB_ID" ) PCTFREE 10
    INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS
    1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    REM ALTER TABLE "HR"."JOBS" ADD CONSTRAINT "JOB_ID_PK" PRIMARY KEY
    REM ("JOB_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    REM STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
    REM DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ENABLE ;
    REM CREATE TABLE "HR"."JOB_HISTORY" ("EMPLOYEE_ID" NUMBER(6, 0)
    REM CONSTRAINT "JHIST_EMPLOYEE_NN" NOT NULL ENABLE, "START_DATE" DATE
    REM CONSTRAINT "JHIST_START_DATE_NN" NOT NULL ENABLE, "END_DATE" DATE
    REM CONSTRAINT "JHIST_END_DATE_NN" NOT NULL ENABLE, "JOB_ID" VARCHAR2(10)
    REM CONSTRAINT "JHIST_JOB_NN" NOT NULL ENABLE, "DEPARTMENT_ID" NUMBER(4,
    REM 0)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL
    REM 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE
    REM "EXAMPLE" NOLOGGING NOCOMPRESS ;
    REM ... 10 rows
    CREATE UNIQUE INDEX "HR"."JHIST_EMP_ID_ST_DATE_PK" ON "JOB_HISTORY"
    ("EMPLOYEE_ID" , "START_DATE" ) PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE INDEX "HR"."JHIST_JOB_IX" ON "JOB_HISTORY" ("JOB_ID" ) PCTFREE 10
    INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS
    1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE INDEX "HR"."JHIST_EMPLOYEE_IX" ON "JOB_HISTORY" ("EMPLOYEE_ID" )
    PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE INDEX "HR"."JHIST_DEPARTMENT_IX" ON "JOB_HISTORY" ("DEPARTMENT_ID"
    ) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    REM ALTER TABLE "HR"."JOB_HISTORY" ADD CONSTRAINT "JHIST_DATE_INTERVAL"
    REM CHECK (end_date > start_date) ENABLE NOVALIDATE ;
    REM ALTER TABLE "HR"."JOB_HISTORY" ADD CONSTRAINT
    REM "JHIST_EMP_ID_ST_DATE_PK" PRIMARY KEY ("EMPLOYEE_ID", "START_DATE")
    REM USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536
    REM FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE
    REM "EXAMPLE" NOLOGGING ENABLE ;
    REM CREATE TABLE "HR"."LOCATIONS" ("LOCATION_ID" NUMBER(4, 0),
    REM "STREET_ADDRESS" VARCHAR2(40), "POSTAL_CODE" VARCHAR2(12), "CITY"
    REM VARCHAR2(30) CONSTRAINT "LOC_CITY_NN" NOT NULL ENABLE,
    REM "STATE_PROVINCE" VARCHAR2(25), "COUNTRY_ID" CHAR(2)) PCTFREE 10
    REM PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    REM FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING
    REM NOCOMPRESS ;
    REM ... 23 rows
    CREATE UNIQUE INDEX "HR"."LOC_ID_PK" ON "LOCATIONS" ("LOCATION_ID" )
    PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE INDEX "HR"."LOC_CITY_IX" ON "LOCATIONS" ("CITY" ) PCTFREE 10
    INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS
    1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE INDEX "HR"."LOC_STATE_PROVINCE_IX" ON "LOCATIONS" ("STATE_PROVINCE"
    ) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    CREATE INDEX "HR"."LOC_COUNTRY_IX" ON "LOCATIONS" ("COUNTRY_ID" ) PCTFREE
    10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST
    GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    REM ALTER TABLE "HR"."LOCATIONS" ADD CONSTRAINT "LOC_ID_PK" PRIMARY KEY
    REM ("LOCATION_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    REM STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
    REM DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ENABLE ;
    REM CREATE TABLE "HR"."REGIONS" ("REGION_ID" NUMBER CONSTRAINT
    REM "REGION_ID_NN" NOT NULL ENABLE, "REGION_NAME" VARCHAR2(25)) PCTFREE
    REM 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS
    REM 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE"
    REM NOLOGGING NOCOMPRESS ;
    REM ... 4 rows
    CREATE UNIQUE INDEX "HR"."REG_ID_PK" ON "REGIONS" ("REGION_ID" ) PCTFREE
    10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST
    GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ;
    REM ALTER TABLE "HR"."REGIONS" ADD CONSTRAINT "REG_ID_PK" PRIMARY KEY
    REM ("REGION_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    REM STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
    REM DEFAULT) TABLESPACE "EXAMPLE" NOLOGGING ENABLE ;
    REM CREATE TABLE "HR"."SUBSCRIPTIONS" ("SUBSCRIPTION_ID" NUMBER,
    REM "USER_ID" NUMBER NOT NULL ENABLE, "SUBSCRIPTION_TYPE" VARCHAR2(50),
    REM "ACTIVE_INDICATOR" VARCHAR2(3)) PCTFREE 10 PCTUSED 40 INITRANS 1
    REM MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1
    REM BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS ;
    REM ... 8 rows
    CREATE UNIQUE INDEX "HR"."SUBS_PK" ON "SUBSCRIPTIONS" ("SUBSCRIPTION_ID" )
    PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING ;
    CREATE UNIQUE INDEX "HR"."SUBS_UK" ON "SUBSCRIPTIONS" ("USER_ID" ,
    "SUBSCRIPTION_TYPE" ) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL
    65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE
    "USERS" LOGGING ;
    REM ALTER TABLE "HR"."SUBSCRIPTIONS" ADD CONSTRAINT "SUBS_PK" PRIMARY KEY
    REM ("SUBSCRIPTION_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    REM STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
    REM DEFAULT) TABLESPACE "USERS" LOGGING ENABLE ;
    REM ALTER TABLE "HR"."SUBSCRIPTIONS" ADD CONSTRAINT "SUBS_UK" UNIQUE
    REM ("USER_ID", "SUBSCRIPTION_TYPE") USING INDEX PCTFREE 10 INITRANS 2
    REM MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1
    REM BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING ENABLE ;
    REM CREATE TABLE "HR"."TDEST" ("KEYVAL" NUMBER, "VAL1" NUMBER, "VAL2"
    REM NUMBER, "VAL3" NUMBER) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
    REM STORAGE(INITIAL 3145728 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
    REM DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS ;
    REM ... 89987 rows
    REM ALTER TABLE "HR"."TDEST" ADD PRIMARY KEY ("KEYVAL") USING INDEX
    REM PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 2097152 FREELISTS
    REM 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING
    REM ENABLE ;
    REM CREATE TABLE "HR"."TRANSACTIONS" ("SUBSCRIPTION_ID" NUMBER, "ACTION"
    REM VARCHAR2(50), "TIMESTAMP" DATE) PCTFREE 10 PCTUSED 40 INITRANS 1
    REM MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1
    REM BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS ;
    REM ... 10 rows
    CREATE UNIQUE INDEX "HR"."TR_PK" ON "TRANSACTIONS" ("SUBSCRIPTION_ID" ,
    "ACTION" , "TIMESTAMP" ) PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS" LOGGING ;
    REM ALTER TABLE "HR"."TRANSACTIONS" ADD CONSTRAINT "TR_PK" PRIMARY KEY
    REM ("SUBSCRIPTION_ID", "ACTION", "TIMESTAMP") USING INDEX PCTFREE 10
    REM INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST
    REM GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING ENABLE ;
    REM CREATE TABLE "HR"."TRANSACTIONS_BACK" ("SUBSCRIPTION_ID" NUMBER,
    REM "ACTION" VARCHAR2(50), "TIMESTAMP" DATE) PCTFREE 10 PCTUSED 40
    REM INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST
    REM GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS ;
    REM ... 10 rows
    REM CREATE TABLE "HR"."TSOURCE" ("KEYVAL" NUMBER, "VAL1" NUMBER, "VAL2"
    REM NUMBER, "VAL3" NUMBER) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
    REM STORAGE(INITIAL 327680 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
    REM DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS ;
    REM ... 9517 rows
    REM ALTER TABLE "HR"."TSOURCE" ADD PRIMARY KEY ("KEYVAL") USING INDEX
    REM PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 262144 FREELISTS 1
    REM FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING
    REM ENABLE ;
    REM CREATE TABLE "HR"."TSOURCE_BACK" ("KEYVAL" NUMBER, "VAL1" NUMBER,
    REM "VAL2" NUMBER, "VAL3" NUMBER) PCTFREE 10 PCTUSED 40 INITRANS 1
    REM MAXTRANS 255 STORAGE(INITIAL 327680 FREELISTS 1 FREELIST GROUPS 1
    REM BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS ;
    REM ... 9517 rows
    REM CREATE TABLE "HR"."USERS" ("USER_ID" NUMBER, "EMAIL" VARCHAR2(100),
    REM "GENDER" CHAR(1), "AGE" NUMBER, "NAME" VARCHAR2(50)) PCTFREE 10
    REM PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
    REM FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING
    REM NOCOMPRESS ;
    REM ... 13 rows
    CREATE UNIQUE INDEX "HR"."USERS_PK" ON "USERS" ("USER_ID" ) PCTFREE 10
    INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS
    1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING ;
    REM ALTER TABLE "HR"."USERS" ADD CONSTRAINT "USERS_PK" PRIMARY KEY
    REM ("USER_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    REM STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
    REM DEFAULT) TABLESPACE "USERS" LOGGING ENABLE ;
    REM ALTER TABLE "HR"."LOCATIONS" ADD CONSTRAINT "LOC_C_ID_FK" FOREIGN KEY
    REM ("COUNTRY_ID") REFERENCES "COUNTRIES" ("COUNTRY_ID") ENABLE
    REM NOVALIDATE ;
    REM ALTER TABLE "HR"."DEPARTMENTS" ADD CONSTRAINT "DEPT_LOC_FK" FOREIGN
    REM KEY ("LOCATION_ID") REFERENCES "LOCATIONS" ("LOCATION_ID") ENABLE
    REM NOVALIDATE ;
    REM ALTER TABLE "HR"."TRANSACTIONS" ADD CONSTRAINT "TR_FK" FOREIGN KEY
    REM ("SUBSCRIPTION_ID") REFERENCES "SUBSCRIPTIONS" ("SUBSCRIPTION_ID")
    REM ENABLE NOVALIDATE ;
    REM ALTER TABLE "HR"."SUBSCRIPTIONS" ADD CONSTRAINT "SUBS_FK" FOREIGN KEY
    REM ("USER_ID") REFERENCES "USERS" ("USER_ID") ENABLE NOVALIDATE ;
    REM ALTER TABLE "HR"."COUNTRIES" ADD CONSTRAINT "COUNTR_REG_FK" FOREIGN
    REM KEY ("REGION_ID") REFERENCES "REGIONS" ("REGION_ID") ENABLE
    REM NOVALIDATE ;
    REM ALTER TABLE "HR"."JOB_HISTORY" ADD CONSTRAINT "JHIST_DEPT_FK" FOREIGN
    REM KEY ("DEPARTMENT_ID") REFERENCES "DEPARTMENTS" ("DEPARTMENT_ID")
    REM ENABLE NOVALIDATE ;
    REM ALTER TABLE "HR"."JOB_HISTORY" ADD CONSTRAINT "JHIST_JOB_FK" FOREIGN
    REM KEY ("JOB_ID") REFERENCES "JOBS" ("JOB_ID") ENABLE NOVALIDATE ;
    REM ALTER TABLE "HR"."EMPLOYEES" ADD CONSTRAINT "EMP_JOB_FK" FOREIGN KEY
    REM ("JOB_ID") REFERENCES "JOBS" ("JOB_ID") ENABLE NOVALIDATE ;
    REM ALTER TABLE "HR"."EMPLOYEES" ADD CONSTRAINT "EMP_DEPT_FK" FOREIGN KEY
    REM ("DEPARTMENT_ID") REFERENCES "DEPARTMENTS" ("DEPARTMENT_ID") ENABLE
    REM NOVALIDATE ;
    REM ALTER TABLE "HR"."EMPLOYEES" ENABLE CONSTRAINT "EMP_SALARY_MIN" ;
    REM ALTER TABLE "HR"."JOB_HISTORY" ENABLE CONSTRAINT
    REM "JHIST_DATE_INTERVAL" ;
    REM ALTER TABLE "HR"."LOCATIONS" ENABLE CONSTRAINT "LOC_C_ID_FK" ;
    REM ALTER TABLE "HR"."DEPARTMENTS" ENABLE CONSTRAINT "DEPT_LOC_FK" ;
    REM ALTER TABLE "HR"."TRANSACTIONS" ENABLE CONSTRAINT "TR_FK" ;
    REM ALTER TABLE "HR"."SUBSCRIPTIONS" ENABLE CONSTRAINT "SUBS_FK" ;
    REM ALTER TABLE "HR"."COUNTRIES" ENABLE CONSTRAINT "COUNTR_REG_FK" ;
    REM ALTER TABLE "HR"."JOB_HISTORY" ENABLE CONSTRAINT "JHIST_DEPT_FK" ;
    REM ALTER TABLE "HR"."JOB_HISTORY" ENABLE CONSTRAINT "JHIST_JOB_FK" ;
    REM ALTER TABLE "HR"."EMPLOYEES" ENABLE CONSTRAINT "EMP_JOB_FK" ;
    REM ALTER TABLE "HR"."EMPLOYEES" ENABLE CONSTRAINT "EMP_DEPT_FK" ;

  • Illustrator script to create symbols from images in folder

    Time to give back to the community...
    Here is a script I recently devised to bulk create symbols from images in a folder. Tested with Illustrator CC 2014.
    // Import Folder's Files as Symbols - Illustrator CC script
    // Description: Creates symbols from images in the designated folder into current document
    // Author     : Oscar Rines (oscarrines (at) gmail.com)
    // Version    : 1.0.0 on 2014-09-21
    // Reused code from "Import Folder's Files as Layers - Illustrator CS3 script"
    // by Nathaniel V. KELSO ([email protected])
    #target illustrator
    function getFolder() {
      return Folder.selectDialog('Please select the folder to be imported:', Folder('~'));
    function symbolExists(seekInDoc, seekSymbol) {
        for (var j=0; j < seekInDoc.symbols.length; j++) {
            if (seekInDoc.symbols[j].name == seekSymbol) {
                return true;
        return false;
    function importFolderContents(selectedFolder) {
        var activeDoc = app.activeDocument;     //Active object reference
      // if a folder was selected continue with action, otherwise quit
      if (selectedFolder) {
            var newsymbol;              //Symbol object reference
            var placedart;              //PlacedItem object reference
            var fname;                  //File name
            var sname;                  //Symbol name
            var symbolcount = 0;        //Number of symbols added
            var templayer = activeDoc.layers.add(); //Create a new temporary layer
            templayer.name = "Temporary layer"
            var imageList = selectedFolder.getFiles(); //retrieve files in the folder
            // Create a palette-type window (a modeless or floating dialog),
            var win = new Window("palette", "SnpCreateProgressBar", {x:100, y:100, width:750, height:310});
            win.pnl = win.add("panel", [10, 10, 740, 255], "Progress"); //add a panel to contain the components
            win.pnl.currentTaskLabel = win.pnl.add("statictext", [10, 18, 620, 33], "Examining: -"); //label indicating current file being examined
            win.pnl.progBarLabel = win.pnl.add("statictext", [620, 18, 720, 33], "0/0"); //progress bar label
            win.pnl.progBarLabel.justify = 'right';
            win.pnl.progBar = win.pnl.add("progressbar", [10, 35, 720, 60], 0, imageList.length-1); //progress bar
            win.pnl.symbolCount = win.pnl.add("statictext", [10, 70, 710, 85], "Symbols added: 0"); //label indicating number of symbols created
            win.pnl.symbolLabel = win.pnl.add("statictext", [10, 85, 710, 100], "Last added symbol: -"); //label indicating name of the symbol created
            win.pnl.errorListLabel = win.pnl.add("statictext", [10, 110, 720, 125], "Error log:"); //progress bar label
            win.pnl.errorList = win.pnl.add ("edittext", [10, 125, 720, 225], "", {multiline: true, scrolling: true}); //errorlist
            //win.pnl.errorList.graphics.font = ScriptUI.newFont ("Arial", "REGULAR", 7);
            //win.pnl.errorList.graphics.foregroundColor = win.pnl.errorList.graphics.newPen(ScriptUIGraphics.PenType.SOLID_COLOR, [1, 0, 0, 1], 1);
            win.doneButton = win.add("button", [640, 265, 740, 295], "OK"); //button to dispose the panel
            win.doneButton.onClick = function () //define behavior for the "Done" button
                win.close();
            win.center();
            win.show();
            //Iterate images
            for (var i = 0; i < imageList.length; i++) {
                win.pnl.currentTaskLabel.text = 'Examining: ' + imageList[i].name; //update current file indicator
                win.pnl.progBarLabel.text = i+1 + '/' + imageList.length; //update file count
                win.pnl.progBar.value = i+1; //update progress bar
                if (imageList[i] instanceof File) {         
                    fname = imageList[i].name.toLowerCase(); //convert file name to lowercase to check for supported formats
                    if( (fname.indexOf('.eps') == -1) &&
                        (fname.indexOf('.png') == -1)) {
                        win.pnl.errorList.text += 'Skipping ' + imageList[i].name + '. Not a supported type.\r'; //log error
                        continue; // skip unsupported formats
                    else {
                        sname = imageList[i].name.substring(0, imageList[i].name.lastIndexOf(".") ); //discard file extension
                        // Check for duplicate symbol name;
                        if (symbolExists(activeDoc, sname)) {
                            win.pnl.errorList.text += 'Skipping ' + imageList[i].name + '. Duplicate symbol for name: ' + sname + '\r'; //log error
                        else {
                            placedart = activeDoc.placedItems.add(); //get a reference to a new placedItem object
                            placedart.file = imageList[i]; //link the object to the image on disk
                            placedart.name =  sname; //give the placed item a name
                            placedart.embed();   //make this a RasterItem
                            placedart = activeDoc.rasterItems.getByName(sname); //get a reference to the newly created raster item
                            newsymbol = activeDoc.symbols.add(placedart); //add the raster item to the symbols                 
                            newsymbol.name = sname; //name the symbol
                            symbolcount++; //update the count of symbols created
                            placedart.remove(); //remove the raster item from the canvas
                            win.pnl.symbolCount.text = 'Symbols added: ' + symbolcount; //update created number of symbols indicator
                            win.pnl.symbolLabel.text = 'Last added symbol: ' + sname; //update created symbol indicator
                else {
                    win.pnl.errorList.text += 'Skipping ' + imageList[i].name + '. Not a regular file.\r'; //log error
                win.update(); //required so pop-up window content updates are shown
            win.pnl.currentTaskLabel.text = ''; //clear current file indicator
            // Final verdict
            if (symbolcount >0) {
                win.pnl.symbolLabel.text = 'Symbol library changed. Do not forget to save your work';
            else {
                win.pnl.symbolLabel.text = 'No new symbols added to the library';
            win.update(); //update window contents
            templayer.remove(); //remove the temporary layer
        else {
            alert("Action cancelled by user");
    if ( app.documents.length > 0 ) {
        importFolderContents( getFolder() );
    else{
        Window.alert("You must open at least one document.");

    Thank you, nice job & I am looking forward to trying it out!

  • How to create ArrayColletion in mx:Script from mx:Model id="results" source="/data/data.xml" /

    How to create ArrayColletion in mx:Script from <mx:Model
    id="results" source="/data/data.xml" />
    Please see my code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Model id="results" source="/data/data.xml" />
    <mx:Script>
    import mx.collections.ArrayCollection;
    import mx.utils.ArrayUtil;
    import mx.controls.Alert;
    </mx:Script>
    <mx:ArrayCollection id ="dt1"
    source="{ArrayUtil.toArray(results.result)}"/>
    <mx:Script><![CDATA[
    [Bindable]
    public var expenses:ArrayCollection = dt1;
    [Bindable]
    public var expenses2:ArrayCollection = dt1;
    [Bindable]
    public var dp:ArrayCollection=expenses;
    public function changeDataProvider():void{
    Alert.show(expenses.toString());
    if (dp==expenses){
    dp=expenses2;
    }else{
    dp=expenses;
    ]]></mx:Script>
    <mx:Panel x="10" y="10" width="100%" height="378"
    layout="absolute">
    <mx:ColumnChart dataProvider="{dt1}" x="10" y="10"
    id="myChart" height="318" width="100%">
    <mx:horizontalAxis>
    <mx:CategoryAxis categoryField="month"/>
    </mx:horizontalAxis>
    <mx:series>
    <mx:ColumnSeries displayName="apple" yField="apple"/>
    <mx:ColumnSeries displayName="orange"
    yField="orange"/>
    <mx:ColumnSeries displayName="banana"
    yField="banana"/>
    </mx:series>
    </mx:ColumnChart>
    <mx:Legend dataProvider="{myChart}" x="481" y="10"/>
    </mx:Panel>
    <mx:Button x="284" y="416" label="Change Data" id="bt"
    click="changeDataProvider()" />
    </mx:Application>

    Tracy,
    Thanks. That worked. However I have another related question:
    I convert the xml feed to a XMLListCollection by doing:
    <mx:XMLListCollection id="mission"
    source="{xmlFeed.lastResult.day}"/>
    and
    <mx:XMLListCollection id="mission1"
    source="{xmlFeed.lastResult.day.tBlock}"/>
    On the chart I have
    <mx:ColumnChart id="missionReadiness" height="150%"
    width="100%"
    paddingLeft="2" paddingRight="2"
    showDataTips="true" dataProvider="{mission1}">
    <mx:series>
    <mx:ColumnSeries xField="" yField="@today"
    displayName="Today"/>
    <mx:ColumnSeries xField="" yField="@tomorrow"
    displayName="Tomorrow"/>
    <mx:ColumnSeries xField="" yField="@afterT"
    displayName="After Tomorrow"/>
    </mx:series>
    </mx:ColumnChart>
    the yField works, but for the xField I want to have the @date
    but refers to the parent node, so I am clueless on how to refer to
    it.
    Also, I would like to display on the chart only the values to
    a specific date (like @date="05/17/2007").
    Any suggestions on how to do that?
    Gilbert

  • Create shell script from in database

    Oracle version : 10.2.0.1.0
    Linux redhat R5
    Hi all,
    I want tio create a procedure to create a shell script from within the database, but it fails.
    set serverout on echo off feed on ver off
    declare
    sfile          utl_file.file_type;
    begin
    sfile := utl_file.fopen('/u01/app/oracle/admin/cds/disks','disk_space.sql','w');
    utl_file.put_line(sfile,'!#!/bin/sh
    utl_file.put_line(sfile,'!df=`df -Pl | grep "^/dev" | awk '{print $5, $6}' | sed "s/%//"`
    utl_file.put_line(sfile,'!do
    utl_file.put_line(sfile,'! "Disk $fs on $HOSTNAME is $percent percent full"
    utl_file.put_line(sfile,'! fi
    utl_file.put_line(sfile,'!done
    utl_file.fclose(sfile);
    end;
    SQL*Plus: Release 10.2.0.1.0 - Production on Tue Aug 10 14:40:16 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    utl_file.put_line(sfile,'!df=`df -Pl | grep "^/dev" | awk '{print $5, $6}' | sed "s/%//"`
    ERROR at line 7:
    ORA-06550: line 7, column 30:
    PLS-00103: Encountered the symbol "!" when expecting one of the following:
    ) , * & | = - + < / > at in is mod remainder not rem => ..
    <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
    LIKE4_ LIKEC_ between || multiset member SUBMULTISET_

    Try this:
    declare
    sfile utl_file.file_type;
    begin
    sfile := utl_file.fopen('/u01/app/oracle/admin/cds/disks','disk_space.sql','w');
    utl_file.put_line(sfile,'!#!/bin/sh');
    utl_file.put_line(sfile,'!df=`df -Pl | grep "^/dev" | awk ''{print $5, $6}'' | sed "s/%//"`');
    utl_file.put_line(sfile,'!do');
    utl_file.put_line(sfile,'! "Disk $fs on $HOSTNAME is $percent percent full"');
    utl_file.put_line(sfile,'! fi');
    utl_file.put_line(sfile,'!done');
    utl_file.fclose(sfile);
    end;PS: Not tested

  • Issue with Generate Create Script in new ODT 11.1.0.5.10 beta

    So I'm trying to determine if there's an issue with the Generate Create Script option in the new ODT 11.1.0.5.10 beta (when you right click on a table in Server Explorer).
    The SQL create script that it generates lacks the slash between lines. For example I generated the create script for my User table and this is what was generated:
    CREATE TABLE "DEV"."SYSTEM_USER_TB" ("RID" NUMBER(10,0),"USER_NAME" VARCHAR2(256 CHAR),"APPLICATION_RID" NUMBER(10,0),"FIRST_NAME" VARCHAR2(256 CHAR),"LAST_NAME" VARCHAR2(256 CHAR),"PW" VARCHAR2(128 CHAR),"PW_FORMAT" NUMBER,"PW_SALT" VARCHAR2(128 CHAR),"LAST_ACTIVITY_DT" DATE,"EXPIRATION_DT" DATE,"EMAIL" VARCHAR2(256 CHAR),"PW_QUESTION" VARCHAR2(256 CHAR),"PW_ANSWER" VARCHAR2(256 CHAR),"APPROVED_FLG" NUMBER(1,0),"LOCKED_OUT_FLG" NUMBER(1,0),"LAST_LOGIN_DT" DATE,"LAST_PW_CHANGED_DT" DATE,"LAST_LOCKOUT_DT" DATE,"FAILED_PW_ATTEMPT_CNT" NUMBER(6,0),"FAILED_PW_ATTEMPT_WINSTART" DATE,"FAILED_PW_ANSW_ATTEMPT_CNT" NUMBER(8,0),"FAILED_PW_ANSW_ATTEMPT_WINSTRT" DATE,"CREATED_BY_RID" NUMBER(10,0),"CREATED_DT" DATE,"MODIFIED_BY_RID" NUMBER(10,0),"MODIFIED_DT" DATE) TABLESPACE "USERS" PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 131072 MAXEXTENTS 2147483645 MINEXTENTS 1 )
    CREATE UNIQUE INDEX "DEV"."XPKSTAFF" ON "DEV"."SYSTEM_USER_TB" ("RID" ) TABLESPACE "USERS"
    ALTER TABLE "DEV"."SYSTEM_USER_TB" ADD ( CONSTRAINT "SYS_C0033033" PRIMARY KEY ("RID") USING INDEX "DEV"."XPKSTAFF" ENABLE VALIDATE )
    ALTER TABLE "DEV"."SYSTEM_USER_TB" ADD ( CONSTRAINT "SYS_C0033032" CHECK ("RID" IS NOT NULL) ENABLE VALIDATE )
    CREATE TRIGGER "DEV"."SYSTEM_USER_TRG1"
    BEFORE
    INSERT
    ON "DEV"."SYSTEM_USER_TB"
    FOR EACH ROW
    begin
         select SYSTEM_USER_SEQ.nextval into :new.RID from dual;
    end;
    In my new Oracle Database Project, if I right click on the script and select "Run" or "Run On", the script fails saying:
    Connected.
    CREATE UNIQUE INDEX "DEV"."XPKSTAFF" ON "DEV"."SYSTEM_USER_TB" ("RID" ) TABLESPACE "USERS"
    ERROR at line 2:
    ORA-00922: missing or invalid option
    If I then add, a slash between lines, the script runs successfully and creates the table/trigger and whatever else just fine. For example, I changed the above generated code to look as follows:
    CREATE TABLE "DEV"."SYSTEM_USER_TB" ("RID" NUMBER(10,0),"USER_NAME" VARCHAR2(256 CHAR),"APPLICATION_RID" NUMBER(10,0),"FIRST_NAME" VARCHAR2(256 CHAR),"LAST_NAME" VARCHAR2(256 CHAR),"PW" VARCHAR2(128 CHAR),"PW_FORMAT" NUMBER,"PW_SALT" VARCHAR2(128 CHAR),"LAST_ACTIVITY_DT" DATE,"EXPIRATION_DT" DATE,"EMAIL" VARCHAR2(256 CHAR),"PW_QUESTION" VARCHAR2(256 CHAR),"PW_ANSWER" VARCHAR2(256 CHAR),"APPROVED_FLG" NUMBER(1,0),"LOCKED_OUT_FLG" NUMBER(1,0),"LAST_LOGIN_DT" DATE,"LAST_PW_CHANGED_DT" DATE,"LAST_LOCKOUT_DT" DATE,"FAILED_PW_ATTEMPT_CNT" NUMBER(6,0),"FAILED_PW_ATTEMPT_WINSTART" DATE,"FAILED_PW_ANSW_ATTEMPT_CNT" NUMBER(8,0),"FAILED_PW_ANSW_ATTEMPT_WINSTRT" DATE,"CREATED_BY_RID" NUMBER(10,0),"CREATED_DT" DATE,"MODIFIED_BY_RID" NUMBER(10,0),"MODIFIED_DT" DATE) TABLESPACE "USERS" PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 131072 MAXEXTENTS 2147483645 MINEXTENTS 1 )
    CREATE UNIQUE INDEX "DEV"."XPKSTAFF" ON "DEV"."SYSTEM_USER_TB" ("RID" ) TABLESPACE "USERS"
    ALTER TABLE "DEV"."SYSTEM_USER_TB" ADD ( CONSTRAINT "SYS_C0033033" PRIMARY KEY ("RID") USING INDEX "DEV"."XPKSTAFF" ENABLE VALIDATE )
    ALTER TABLE "DEV"."SYSTEM_USER_TB" ADD ( CONSTRAINT "SYS_C0033032" CHECK ("RID" IS NOT NULL) ENABLE VALIDATE )
    CREATE TRIGGER "DEV"."SYSTEM_USER_TRG1"
    BEFORE
    INSERT
    ON "DEV"."SYSTEM_USER_TB"
    FOR EACH ROW
    begin
         select SYSTEM_USER_SEQ.nextval into :new.RID from dual;
    end;
    So, does anyone know if this is a bug? Could I be missing an option to add in the slashes to the generated code? Is there an option to not require the slashes? Could there be another way to execute these scripts?
    Seriously, I think I'm having deja vu from the last release of the Dev Tools: Generate Create Script creates scripts that won't run: ORA-00922: missing..
    ...except this time the documentation says I should be able to use the "Run" and "Run On" commands in the Oracle Database Project (see page 8): http://www.oracle.com/technology/tech/dotnet/pdf/ODT11_whatsnew.pdf
    null

    There are 2 issues in the generated script :
    1. Missing semicolons at the end of the create stmts
    2. Missing slashes
    Both of these fixes will be available in the ODT 11.1 release.

  • Cannot create mysites from powershell: Original XSLT List View Web Part not found

    I have a bizarre problem in my SharePoint 2013 farm. This does not occur in my test farm, only in the farm we were going to go live with.
    I'm on windows Server 2012, SQLServer 2012 SP1, SharePoint 2013 April CU. 1 appserver/centraladmin server, 2 web servers.
    When I log into our mysitehost and click newsfeed, it will create a mysite (even though first it displays "we are sorry there was a problem creating your site")
    But from powershell, whether I use $UserProfile.CreatePersonalSite() or New-SPSite, I get the following error:
    Original XSLT List View Web Part not found
    So far I've only found one other person with this:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/2503e42c-e114-4e89-8e00-89fe70f0b154/cannot-create-sharepoint-mysite-programmatically
    This is a brand new farm, created with the same scripts I created my test farm with, and same version of SharePoint. Only the service accounts are different. (Farm account has admin on the servers right now since I was setting up profile service).
    Some other errors from the same correlation ID that look related:
    It can't seem to find the listemplate 101
    And something looks wrong with the MySiteDocumentLibrary feature
    I have tried the following:
    1. run psconfig.exe on each server
    2. install-spfeature -AllExistingFeatures
    3. looped through the directory under Features and for each called Install-SPFeature $dirname -Force
    4. uninstalled and reinstalled MySiteDocumentLibrary feature
    5. blew away the whole farm (removed all servers from farm, deleted all databases) and recreated it.
    6. tried creating the UPA from the CentralAdmin gui.
    The only real difference I can think of between the working farm and non working farm is, I installed the working farm using RTM, then as they came out added the March PU and April CU. For this farm I installed RTM and March and April, and then ran my build
    farm script.
    I am at a loss. What do I need to do, re-install the binaries? That's all I can think of. What I love is that our test / POC system worked fine, and now 2 weeks before go-live I'm seeing errors on the production servers I've never seen before. Using the
    same scripts no less.
    Feature Activation: Feature 'Fields' (ID: 'ca7bd552-10b1-4563-85b9-5ed1d39c962a') was activated
    Feature Activation: Feature 'CTypes' (ID: '695b6570-a48b-4a8e-8ea5-26ea7fc1d162') was activated
    No document templates uploaded for list "$Resources:core,global_onet_solutiongallery_list;" -- none found for list template "100"
    Failed to find <ListTemplate> tag corresponding to ID "101", tried both onet.xml for site definition ID "0" language "1033" and global site definition. Operation failed.
    No document templates uploaded for list "$Resources:core,stylelibraryList;" -- none found for list template "121".
    System.Runtime.InteropServices.COMException: A user may not remove his or her own account from a site collection.<nativehr>0x81020051</nativehr><nativestack></nativestack>, StackTrace: at Microsoft.SharePoint.SPUserCollection.UpdateMembers
    Feature Activation: Feature 'MySitePersonalSite' (ID: 'f661430e-c155-438e-a7c6-c68648f1b119') was activated
    Feature Activation: Activating Feature 'MySiteDocumentLibrary'
    Calling 'FeatureActivated' method of SPFeatureReceiver for Feature 'MySiteDocumentLibrary'
    SharePoint Foundation Upgrade MySiteDocumentLibraryFeatureReceiveraj08n INFO Creating new My Documents library
    Unknown SPRequest error occurred. More information: 0x80070002
    SPRequest.GetMetadataForUrl: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://contoso/personal/cbuchholz/DOCUMENTS ,METADATAFLAGS=59
    System.IO.FileNotFoundException: <nativehr>0x80070002</nativehr><nativestack></nativestack>, StackTrace: at Microsoft.SharePoint.SPWeb.GetObjectForUrl at Microsoft.SharePoint.Portal.UserProfiles.MySiteDocumentLibraryUtil.GetSPObjectFromUrl ...
    <nativehr>0x80070002</nativehr><nativestack></nativestack>There is no Web named "/personal/cbuchholz/DOCUMENTS"
    Possible mismatch between the reported error with code = 0x81070504 and message: "There is no Web named "/personal/cbuchholz/DOCUMENTS"." and the returned error with code 0x80070002.
    Attemping to add webpart id 0F6072F2-E804-4CFD-837E-BB37332B9D1C to web http://contoso/personal/cbuchholz
    Adding XsltListViewWebPart calling SPRequest::CreateListViewPart. Web part id 0F6072F2-E804-4CFD-837E-BB37332B9D1C, web http://contoso/personal/cbuchholz
    Feature receiver assembly 'Microsoft.SharePoint.Portal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c', class 'Microsoft.SharePoint.Portal.UserProfiles.MySiteDocumentLibraryFeatureReceiver', method 'FeatureActivated' for feature 'e9c0ff81-d821-4771-8b4c-246aa7e5e9eb' threw an exception: System.InvalidOperationException: Original XSLT List View Web Part not found at Microsoft.SharePoint.Portal.UserProfiles.MySiteDocumentLibraryUtil.ReplaceListViewWebPart
    Feature Activation: Threw an exception, attempting to roll back. Feature 'MySiteDocumentLibrary'
    Exception in EnsureFeaturesActivatedAtSite: System.InvalidOperationException: Original XSLT List View Web Part not found
    Failed to activate site-collection-scoped features for template 'SPSPERS#2' in site collection 'http://contoso/personal/cbuchholz'
    Failed to apply template "SPSPERS#2" to web at URL "http://contoso/personal/cbuchholz
    I've had other problems in this farm: the bug where when you add Administrators to a Search Service via the Manage Service Applications page, it removes the SPSearchDBAdmin role from the search service process account. That one did not happen in the other farm.
    At least other people have that one and I could just use the farm admin instead (still troublng of course).

    Ok,
    Here is the problem:
    When creating a mysite from powershell or script, apparently you can ONLY do this from a wfe (or a server running Microsoft SharePoint Foundation Web Application in services on server).
    You CANNOT create mysites from script on your appserver if it is not also a Web Application Server. I confirmed the same is true in my test farm. I guess I was always running most of these scripts on the webserver.
    I searched all over and cannot find this documented anywhere.
    Who do I contact to have Microsoft document this?
    It's Thursday morning, I've been working non stop since Saturday morning so you don't have to :)

  • How to call a shell script from a java code

    Hello can any one suggest me how to call a shell script from a java program that takes three parameters.
    i have a shell script (msp_restore_gui) when i run this script in the command line in a RHEL5 ,SUSE10 and Debian machine it works fine .I even tested to call it from a java program and it also worked fine but when i used the same in a J2ee application where the user when clicks the restore button in a webserver this inturn sends the request to a java file named BackupManager.java where i call the shell script.But here it fails.Waiting for your suggestions.If you want i can put the code also here

    yes the script is in /usr/local/mss/tools/backup and the script (msp_restore_gui) is as follows
    #!/bin/sh
    TIMESTAMP=`date +%d_%b_%y-%H-%M`
    touch /var/backups/mss/mss_restore_"$TIMESTAMP".log
    LOGFILE="/var/backups/mss/mss_restore_"$TIMESTAMP".log"
    ### Explode tgz file
    cd /
    # Checks to be done:
    # root login
    # assume he passes the parameter as msp_backup_<timestamp>
    # check for the existence of the .tz and fileList.txt
    # Checking for the root login and if not logged on as root
    # permission will be denied to execute this script
    logmsg(){
    echo "`date`: $*" >> $LOGFILE 2>&1
    echo "$*"
    #usage of this script
    while [ $#  -ne 0 ]
    do
    case $1 in
    -n)
    shift
    ARCHIVE_NAME=`find / \( -name "$1.tz" -o -name "$1.tgz" \) 2>/dev/null`
    FILE_NAME=`find / -name $1_filesList.txt 2>/dev/null`
    if [ x$ARCHIVE_NAME = x -a y$FILE_NAME = y ]
    then
    logmsg "ERROR: Files not found, Restore cannot proceed"
    usage
    else
    tar tvzf $ARCHIVE_NAME > /dev/null 2>&1
    if [ $? -ne 0 ]
    then
    echo "ERROR: The tar file $ARCHIVE_NAME is not proper. Restore cannot proceed"
    exit 1
    else
              echo "Backedup files are present, proceeding with restore......" >> $LOGFILE 2>&1
    fi
    fi
    usage
    SKIP_CLEANUP=1
    STATUS=1
    exit
    esac
    shift
    done
    rm -rf ./newfile
    curr_ver_file="/usr/local/mss/etc/version"
    /usr/local/mss/tools/backup/check_version $curr_ver_file $FILE_NAME
    ret_code=$?
    echo "Exit value of check_version is $ret_code"
    if [ "$ret_code" != 0 ]
    then
    logmsg "MSP Version not matching. Exiting from restore now...."
    errormsg=`cat /usr/local/mss/temp/ver_err_mesg`
    logmsg $errormsg
    rm -f /usr/local/mss/temp/ver_err_mesg
    exit 1
    else
    echo "Version check is successful"
    fi
    #### ShutDown MSS########
    /etc/init.d/mss stop
    sleep 2
    ### Shutdown semm
    /etc/init.d/semm stop
    sleep 2
    rm -rf `grep -v "MSP Version:" $FILE_NAME`
    logmsg "MSP restore in progress......"
    tar mxvfz $ARCHIVE_NAME >> $LOGFILE
    sleep 5
    ### Call mysql restore script
    /usr/local/mss/bin/mysql_alldb_restore.sh >> $LOGFILE 2>&1
    if [ $? -ne 0 ]; then
    logmsg "Database restore Failed. Cannot proceed further"
    exit 1 ;
    else
    logmsg "Database restore Succeeded."
    fi
    ### Remove DB Dump Files
    rm -f /var/lib/mysql-dumps/*
    ### Trigger cleanup of airprism database tables
    #touch /usr/local/mss/airprism/server/config/reinitdb
    ### Trigger re-import of software packages
    touch /usr/local/mss/swdepot/reimport
    ### Remove log files under the "apps" directory
    find /usr/local/mss/apps -name '*.log*' | xargs rm -f
    find /usr/local/mss/logs -follow -name '*[._]log*' | xargs rm -f
    if [ $? -ne 0 ]; then
    logmsg "MSP restore Failed. Cannot proceed further"
    exit 1 ;
    else
    logmsg "MSP restore Succeeded."
    fi
    # reinstall_patch is touched so that patches are re-installed after restoring of MSP.
    touch /usr/local/mss/patch/bin/reinstall_patch
    ##### Start MSS
    logmsg "restarting MSP server "
    /etc/init.d/mss start
    sleep 5
    ### Start semm
    /etc/init.d/semm start
    sleep 5
    logmsg "MSP server is now restarted"
    my jsp page backup.jsp is as follows
    <%@taglib uri="portlet.tld" prefix="uif" %>
    <%@taglib uri="msp-console.tld" prefix="msp" %>
    <uif:defineObjects/>
    <%@page import="javax.portlet.*" %>
    <%@ page import="java.util.Date" %>
    <%@ page import="java.util.Vector" %>
    <%@ page import="java.text.DateFormat" %>
    <%@ page import="com.symbol.mss.console.admin.backup.BackupManager" %>
    <%@ page import="com.symbol.mss.console.admin.system.SystemInfoPortlet" %>
    <%
         String STYLE_NAME = request.getParameter("style");
         if (STYLE_NAME == null) STYLE_NAME = STYLE_DEFAULT;
         final String ua = request.getHeader("User-Agent");
         BackupManager helper = null;
         PortletSession portletSession = renderRequest.getPortletSession();
         helper = (BackupManager)portletSession.getAttribute("helper");
         if (helper == null) {
              //System.err.println("Created new BackupManager");
              helper = new BackupManager();
              portletSession.setAttribute("helper", helper);
         final BackupManager backupManager = helper;
         String action = "";
         final String backupName = renderRequest.getParameter("backupName");
         String completePath = backupManager.getBackupDir() + backupName + backupManager.getBackupFileExt();
         if (backupName != null) {
              action = "backup";
         if(backupManager.backup(backupName)) {
              SystemInfoPortlet.beginRestartMSP();
              } else {
                   action = "backuperror";          
         final String cmd = renderRequest.getParameter("submitButton");
    final String selectedBackup = renderRequest.getParameter("selectedBackup");
    int tarFileStatus =0;
    String backupTarFile ="";
    String backupFileList ="";
         if ("Restore".equals(cmd)) {
    if (selectedBackup != null) {
         tarFileStatus = backupManager.verifyTarFile(selectedBackup);
         //backupTarFile = backupManager.getRestoreFile(Integer.parseInt(selectedBackup));
         //backupFileList = backupTarFile.substring(0, backupTarFile.lastIndexOf(backupManager.getBackupFileExt()))+"_filesList.txt";
                   if (tarFileStatus == 0){
         action = "restore";
         backupManager.restore(selectedBackup);
                        SystemInfoPortlet.beginRestartMSP();
              } else {
                   action = "error";
    } else if ("Remove".equals(cmd)) {
    backupManager.remove(Integer.parseInt(selectedBackup));
         DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
         PortletURL restoreURL = renderResponse.createActionURL();
    %>
    <%@ include file="/jsp/core/constants.jspf" %>
    <% if (action.length() > 0) {
         if ("backup".equals(action))
    %>
         <p>The MSP Appliance has been shut down in order to create the <%=backupName %> backup file,
              and will automatically restart as soon as the file has been created.
              To continue your work, please log out of the MSP Console, wait for the appliance
              to restart, and then log back in. The amount of time you'll have to wait for the
              MSP Appliance to come back online depends on the amount of information you have
              stored in the MSP Database.</p>
         <p>The full pathname for the backup file is: <%=completePath %></p>     
    <%     }
         else if ("restore".equals(action))
    %>
         <p>The MSP Appliance has been shut down in order to restore from the <%=backupTarFile%> backup file,
              and will automatically restart as soon as the restore is complete.
              To continue your work, please log out of the MSP Console, wait for the appliance
              to restart, and then log back in. The amount of time you'll have to wait for the
              MSP Appliance to come back online depends on the amount of information you have
              stored in the MSP Database.</p>     
    <%     } else if ("backuperror".equals(action)) { %>
              <p><img src="images/dialogue/error_16.gif" class="icon" alt="Notify" /> Errors occurred while taking back up of MSP. Please see the backup service log file for more details.
              </P>
    <%     } else if ("error".equals(action)) {
              if (tarFileStatus == 4) { %>
                   <p><img src="images/dialogue/error_16.gif" class="icon" alt="Notify" /> The backup file <%=backupTarFile%> contains errors. This backup can't be restored. Please restore a valid back up.
                   </P>
              <%} else if (tarFileStatus == 3) { %>
                   <p><img src="images/dialogue/error_16.gif" class="icon" alt="Notify" /> The backup file list <%=backupFileList %> is missing. This file is required to restoring backup. Please get the backup file list and proceed with restoring backup.</p>
              <%} else if (tarFileStatus == 2) { %>
                   <p> <img src="images/dialogue/error_16.gif" class="icon" alt="Notify" /> The backup file <%=backupTarFile%> contains errors and the backup file list <%=backupFileList%> is missing. This backup can't be restored. </p>
              <%} %>
    <%     }
    } else { %>
    <p><strong>Note</strong>: Both backup and restore will shut down MSP temporarily. MSP will be unable to collect data from devices, send notifications, or provide MSP Console access during this time. When the backup or restore operation is complete, MSP will come back online automatically.</p>
    <h3>Backup</h3>
    <form action="<%= restoreURL.toString() %>" method="post">
    <p>Please provide a name for your backup. MSP will provide the date automatically in the list of backups.</p>
    <p><label for="<uif:namespace />backupName">Name</label> <input type="text" name="<uif:namespace />backupName" id="<uif:namespace />backupName" size="20" maxlength="256" /> <input type="submit" name="<uif:namespace />submitButton" value="Back up now" onclick="return <uif:namespace/>validateName()"/></p>
    </form>
    <h3>Restore</h3>
    <p>This will restore all databases (device assets, collected device data, software packages, policies, etc.) to their state as of the time the backup was made. Changes since then <em>except for backups</em> will be destroyed.</p>
    <%
    Vector restoreList = helper.getRestoreEntries();
    Vector restoreDates = helper.getRestoreDates();
    Vector restoreVersions = helper.getRestoreVersions();
    Vector filesStatus = helper.getBackupFilesStatus();
    %>
    <% if (restoreList.size() == 0) { %>
    <p>There are no backups currently available.</p>
    <% } else { %>
    <form action="<%= restoreURL.toString() %>" method="post">
    <table class="input-radios" id="<uif:namespace />existingBackups">
    <thead>
    <tr>
    <th></th>
    <th>Name</th>
    <th>Date</th>
    <th>MSP Version</th>
    <th>Remarks </th>
    </tr>
    </thead>
    <tfoot>
    <tr>
    <td colspan="4" class="actionsOnSelected">
    <input type="submit" name="<uif:namespace />submitButton" value="Restore" onclick="return confirm('This action requires MSP and all related services to be shut down. Console will be unavailable if the request is submitted. The server will restart automatically once restore has been completed.');" />
    <input type="submit" name="<uif:namespace />submitButton" value="Remove" onclick="return confirm('This action will remove the backup archive. You will no longer be able to restore this backup. Continue?');" />
    </td>
    </tr>
    </tfoot>
    <tbody><%-- First one (most recent) is checked by default. Every other row has class="portlet-section-alternate". Note that each ID must be unique and must match the value of the "for" attribute on the corresponding "label" element. --%>
    <%
    for (int i = 0; i < restoreList.size(); i++) {
    %>
    <tr <%= (i % 2 == 1) ? " class=\"portlet-section-alternate\"" : "" %>>
    <td><input type="radio" name="<uif:namespace />selectedBackup" value="<%= i %>" id="<uif:namespace />selectedBackup-<%= i %>" <%= (i == 0) ? "checked=\"checked\"" : "" %> /></td>
    <td><label for="<uif:namespace />selectedBackup-<%= i %>"><%= restoreList.elementAt(i) %></label></td>
    <td><%= dateFormat.format((Date)restoreDates.elementAt(i)) %></td>
    <td><%= restoreVersions.elementAt(i) %></td>
    <td><%= filesStatus.elementAt(i) %></td>
    </tr>
    <%
    %>
    </tbody>
    </table>
    </form>
    <% } %>
    <% } %>
    <script type="text/javascript">
    <!--//--><![CDATA[//><!--
    function <uif:namespace/>validateName() {
    var name =document.getElementById("<uif:namespace />backupName");
    var msg= "<msp:i18n key="BackupMsg"/>";
    var str=name.value;
    var re = /^[A-Za-z0-9_]+$/;
    if (!str.match(re)) {
         alert(msg);
         name.focus();
         return false;
         } else {
    return confirm('This action requires MSP and all related services to be shutdown. Console will be unavailable if the request is submitted. The server will restart automatically once backup has been completed.');
    //--><!]]>
    </script>
    and my BackupManager.java is as follows where the code in bold and italic is called the restore()
    //============================================================================
    // Symbol Technologies P R O P R I E T A R Y S O U R C E C O D E
    // C O N F I D E N T I A L
    // Copyright (c) 2003 Symbol Technologies. All Rights Reserved.
    // All information contained herein is the property of Symbol Technologies,
    // or its Licensors, and are protected copyrights and trade secrets, and may
    // be covered by U.S. patents. Any reproduction or dissemination of any
    // portion of this document, of the software, or other works derived from it
    // is strictly forbidden unless prior written permission is obtained from
    // Symbol Technologies.
    //============================================================================
    package com.symbol.mss.sdf.services.backup;
    import java.io.*;
    import java.sql.Time;
    import java.text.DateFormat;
    import java.util.logging.FileHandler;
    import java.util.logging.Formatter;
    import java.util.logging.LogRecord;
    import java.lang.Process;
    import java.util.*;
    import org.apache.avalon.framework.configuration.Configurable;
    import org.apache.avalon.framework.configuration.Configuration;
    import org.apache.avalon.framework.configuration.ConfigurationException;
    import org.apache.avalon.framework.logger.LogEnabled;
    import org.apache.avalon.framework.logger.Logger;
    import com.symbol.mss.sdf.admin.AdministratorService;
    import com.symbol.mss.sdf.backup.*;
    import com.symbol.mss.sdf.data.*;
    * @author nramaiah
    * Service to perform scheduled backups of the system state.
    public class BackupManager implements BackupService, DataHandler,
    LogEnabled, Configurable {
    // MSS Home Path
    private static String mssHome = System.getProperty("phoenix.home", File.separator + "usr" +
    File.separator + "local" +
    File.separator + "mss" +
    File.separator);
    // Backup related definitions
    private static final String BACKUP_LIST_FILE_NAME = "conf" + File.separator + "files_to_backup.txt";
    private static final String BACKED_UP_LIST_FILE_NAME_SUFFIX = "_filesList.txt";
    private static final String BACKUP_LOCATION = File.separator + "var" + File.separator + "lib" +
    File.separator + "mss-backups" + File.separator;
    private static final String BACKUP_PARTITION = File.separator + "var" + File.separator + "lib";
    private static final String VERIFY_BACKUP = File.separator + "usr" + File.separator + "local" +
                                                           File.separator + "mss" + File.separator+"tools"+
                                                           File.separator+"backup"+File.separator+"verifyBackup.sh";
    // DB backup/restore related definitions
    private static final String DB_DUMP_LOCATION = File.separator + "var" + File.separator +
    "lib" + File.separator +
    "mysql-dumps" + File.separator;
    private static final String DB_BACKUP_SCRIPT = "bin" + File.separator + "mysql_alldb_backup.sh";
    private static final String DB_RESTORE_SCRIPT = "bin" + File.separator + "mysql_alldb_restore.sh";
    // Private variables
    private AdministratorService m_admin = null;
    private Logger m_logger = null;
    private String backupLocation = null;
    private String backupListFileName = null;
    private String backupPartition = null;
    private int backupPartitionLimit = 90;
    private String dbDumpLocation = null;
    private String dbBackupScript = null;
    private String dbRestoreScript = null;
    private List servicesBackupList = null;
    private String tarFileExtension =".tgz";
    private String errFileExtension =".err";
    private int exitValue=0;
    * Default Constructor
    public BackupManager() {
    servicesBackupList = new ArrayList();
    * Set the administrator service implementation. Link established by Broker service.
    * @param admin reference to an implementation of AdministratorService
    public void setAdministrator(AdministratorService admin) {
    m_admin = admin;
    * Set the job publisher service implementation. Link established by Broker service.
    * @param jobPublisher reference to an implementation of JobPublisherService
    public void setJobPublisher(DataChannel jobPublisher) {
    jobPublisher.subscribe(this);
    * Gets the backup manager object.
    * @return backup manager object
    public BackupService getBackupService() {
    return this;
    * Service lifecycle method.
    * @param logger logger object to be used by the service
    public void enableLogging(Logger logger) {
    m_logger = logger;
    * Service lifecycle method.
    * @param configuration service configuration object
    public void configure(Configuration configuration) throws ConfigurationException {
    // Verify MSS Home path
    if (!mssHome.endsWith(File.separator))
    mssHome += File.separator;
    // Get the location where the backup file needs to be placed
    backupLocation = configuration.getChild("BackupLocation").getValue(BACKUP_LOCATION);
    // Verify backup directory path
    if (!backupLocation.startsWith(File.separator))
    backupLocation = mssHome + backupLocation;
    if (!backupLocation.endsWith(File.separator))
    backupLocation += File.separator;
    // Get the file listing the files/directories to be backed up
    backupListFileName = configuration.getChild("FilesList").getValue(BACKUP_LIST_FILE_NAME);
    // Verify backup list file name path
    if (!backupListFileName.startsWith(File.separator))
    backupListFileName = mssHome + backupListFileName;
    // Get the partition where the backups are kept
    backupPartition = configuration.getChild("BackupPartition").getValue(BACKUP_PARTITION);
    // Verify backup partition path
    if (!backupPartition.startsWith(File.separator))
    backupPartition = File.separator + backupPartition;
    if (backupPartition.endsWith(File.separator))
    backupPartition = backupPartition.substring(0, (backupPartition.length()-1));
    // Get the limit on the amount of free space on the backup partition
    backupPartitionLimit = configuration.getChild("BackupPartitionLimit").getValueAsInteger(backupPartitionLimit);
    // Get the location where the DB dump files will be placed
    dbDumpLocation = configuration.getChild("DBDumpLocation").getValue(DB_DUMP_LOCATION);
    // Verify DB dump directory path
    if (!dbDumpLocation.startsWith(File.separator))
    dbDumpLocation = mssHome + dbDumpLocation;
    if (!dbDumpLocation.endsWith(File.separator))
    dbDumpLocation += File.separator;
    // Get the name of DB dump backup script
    dbBackupScript = configuration.getChild("DBBackupScript").getValue(DB_BACKUP_SCRIPT);
    // Verify backup script path
    if (!dbBackupScript.startsWith(File.separator))
    dbBackupScript = mssHome + dbBackupScript;
    // Get the name of DB dump restore script
    dbRestoreScript = configuration.getChild("DBRestoreScript").getValue(DB_RESTORE_SCRIPT);
    // Verify restore script path
    if (!dbRestoreScript.startsWith(File.separator))
    dbRestoreScript = mssHome + dbRestoreScript;
    * Individual services can supply a list of files/directories to be backed up.
    * These are files apart from the files specified in conf/files_to_backup.txt and
    * will be backed up as well.
    * @param files list of files/directories
    public void filesToBackup(List files) {
    synchronized(this) {
    if (files != null) {
    if (files.size() > 0) {
    // Add the list contents to the current backup list
    for (int i=0; i<files.size(); i++) {
    String tStr = (String)files.get(i);
    // Check for absolute or relative path
    if (tStr.startsWith(File.separator))
    servicesBackupList.add(tStr);
    else
    servicesBackupList.add(mssHome + tStr);
    else
    m_logger.info("Empty list of filenames. Nothing added.");
    else
    m_logger.info("Null list of filenames. Nothing added.");
    * Individual services can supply a list of files/directories to be backed up.
    * Specified files will be added to the file defining the list of files to be backed up.
    * @param files list of files/directories
    private void persistFilesToBackup(List files) {
    synchronized(this) {
    if (files != null) {
    if (files.size() > 0) {
    // Add the list of files provided to the end of file
    try {
    File file = new File(backupListFileName);
    if ((file == null) || (!file.exists()))
    file.createNewFile();
    // Seek to the end of the file
    RandomAccessFile rFile = new RandomAccessFile(file, "rw");
    if (rFile != null) {
    rFile.seek(rFile.length());
    // Write the list contents to the file
    for (int i=0; i<files.size(); i++) {
    String tStr = (String)files.get(i);
    // Check for absolute or relative path
    if (tStr.startsWith(File.separator))
    rFile.writeBytes(tStr + "\n");
    else
    rFile.writeBytes(mssHome + tStr + "\n");
    else
    m_logger.error("Error opening file " + backupListFileName);
    rFile.close();
    catch (Exception ex) {
    ex.printStackTrace();
    m_logger.error("Error adding entries to file " + backupListFileName, ex);
    else
    m_logger.info("Empty list of filenames. Nothing added.");
    else
    m_logger.info("Null list of filenames. Nothing added.");
    * Command to be run during the backup process. Individual services can
    * provide shell commands that will be executed before backing up the files.
    * @param command shell command to be executed
    private void runCommand(String command) {
    * Creates a shell script at the specified location that will backup the
    * files listed in the List passed in.
    * @param scriptFileName location where the script needs to be created
    * @param backupFileName name for the tar file being created
    * @param backupList list of files to be backed up
    private void createBackupScript(String scriptFileName, String backupFileName, ArrayList backupList) throws Exception {
    // Create a new StringBuffer to build the contents to be written to the script file
    StringBuffer buffer = new StringBuffer();
    // Add the initial comment in the start script
    buffer.append("#!/bin/sh\n" + "set -x\n\n");
    // Check if the partition has enough space
    buffer.append("### Check if the partition has enough space\n" +
    // "diskUsed=`df -k | grep \"" + backupPartition + "\" | awk '{print $5}' | cut -d\"%\" -f1`\n" +
                   " diskUsed=`df -k \"" + backupPartition + "\" | awk '{print $5}' | cut -d\"%\" -f1 | grep -v Use`\n" +     
    "echo \"Partition " + backupPartition + " is $diskUsed% used.\"\n" +
    "if [ \"$diskUsed\" -lt \"" + backupPartitionLimit + "\" ]\nthen\n" +
    " echo \"Starting backup...\"\n\n");
    // Shutdown semmd
    buffer.append(" ### Shutdown semm\n" + " /etc/init.d/semm stop\n" +
    " sleep 2\n\n");
    // MSP Limited release and earlier builds stop mysql DB and backup the
    // /var/lib/mysql directory as it is. Starting MSP 1.0 GA release, mysql
    // dump script will be integrated which will create sql scripts to
    // restore the database.
    // Check if mysql dump creation script exists
    File mysqlDumpScript = new File(dbBackupScript);
    if (mysqlDumpScript.exists()) {
    // MSP 1.0 GA and later releases
    // Run the script that will generate sql scripts that would re-create the DB as it is
    buffer.append(" ### Call mysql dump script\n" +
    " " + dbBackupScript + "\n\n");
    else {
    // MSP Limited release
    // Add command to shutdown mysql
    buffer.append(" ### Shutdown mysql\n" + " /etc/init.d/mysql stop\n\n");
    // Change to root directory and create the tgz file
    buffer.append(" ### Create tgz file\n" + " cd /\n");
    // Build up the tar file name from the current date and time
    String fileName = null;
    if ((backupFileName != null) && (backupFileName.length() > 0))
    fileName = backupFileName;
    else {
    // File name not provided by user, build one using the timestamp
    Calendar cal = Calendar.getInstance();
    Date date = cal.getTime();
    fileName = "MSS-"
    + DateFormat.getDateInstance().format(date).replaceAll(" ", "").replaceAll(",", "")+ "-"
    + (new Time(cal.getTimeInMillis())).toString().replaceAll(":", "").substring(0,4);
    String tarFileName = fileName + ".tgz";
    // Get the current MSP Version
    String mspVersion = getMSPVersion();
    // Gather all the files to be backed up. Add them to the tar command and
    // also dump them into the file maintaining the list of files being backed up
    String listStr = "";
    for (int i=0; i<backupList.size(); i++)
    listStr += (String)backupList.get(i) + "\n";
    // Dump the current MSP version and the list of files being backed up into a manifest file
    String listFileName = fileName + BACKED_UP_LIST_FILE_NAME_SUFFIX;
    RandomAccessFile file = new RandomAccessFile(backupLocation + listFileName, "rw");
    m_logger.info("List of files/directories being backed up:\n" + listStr);
    file.writeBytes("### MSP Version: " + mspVersion + " ###\n");
    file.writeBytes(listStr);
    file.close();
    // Add the tar command to the script
    buffer.append(" echo \"Creating " + backupLocation + tarFileName + "...\"\n" +
    " tar cvhfz " + backupLocation + tarFileName + " `grep -v \"MSP Version:\" " +
    backupLocation + listFileName + "`\n\n");
    // Check if free space on the backup partition has reduced below the limit
    // If enough space left, backup is retained, "mss" is made the owner of the files,
    // "backup" is made the group the files belong to,
    // permissions changed to be "0660" and
    // backup action declared a success
    // Else, backup files are deleted and declared a failure
    buffer.append(" ### Check if the partition has enough space left\n" +
    //" diskLeft=`df -k | grep \"" + backupPartition + "\" | awk '{print $5}' | cut -d\"%\" -f1`\n" +
    " diskLeft=`df -k \"" + backupPartition + "\" | awk '{print $5}' | cut -d\"%\" -f1 | grep -v Use`\n" +
    " echo \"Partition " + backupPartition + " is $diskLeft% used.\"\n" +
    " if [ \"$diskLeft\" -gt \"" + backupPartitionLimit + "\" ]\n" +
    " then\n" +
    " ### Failure\n" +
    " echo \"Partition " + backupPartition + " does not have enough space.\"\n" +
    " echo \"Backup " + backupLocation + tarFileName + " will be removed.\"\n" +
    " rm -f " + backupLocation + fileName + "*\n" +
    " echo \"Backup Failed.\"\n" +
    " else\n" +
                        " tar tvzf " + backupLocation + tarFileName + " > /dev/null 2>&1\n" +
    " if [ ! -s " + backupLocation + tarFileName + " -o $? -ne 0 ] \n" +
                        " then\n" +
                        " echo \"MSP Backup operation is not successful. The tar file " + backupLocation + tarFileName + " contains errors.\"\n" +
                        " echo \"Please take the backup again\"\n" +
                        "     touch "+backupLocation+fileName+".err\n" +
    " else \n" +
    " ### Success\n" +
    " ### Change the owner, group and permissions for the backup files\n" +
    " chown mss " + backupLocation + fileName + "*\n" +
    " chgrp backup " + backupLocation + fileName + "*\n" +
    " chmod 0660 " + backupLocation + fileName + "*\n" +
    " echo \"Backup Completed.\"\n" +
    " fi\n" +
    " fi\n\n");
    // MSP Limited release and earlier builds re-start mysql. Starting
    // MSP 1.0 GA release, mysql is not stopped and so re-start is not
    // needed. sql scripts created by the dump script get packed into
    // the tar file and so are deleted.
    // Check if mysql dump creation script exists
    if (mysqlDumpScript.exists()) {
    // MSP 1.0 GA and later releases
    // Remove DB dump files
    buffer.append(" ### Remove DB Dump Files\n" + " rm -f " + dbDumpLocation + "*\n\n");
    else {
    // MSP Limited release
    // Start mysql
    buffer.append(" ### Start mysql\n" + " /etc/init

  • Cannot Execute Any UNIX Scripts From DAC

    Hello,
    I have a BI system implementation on Oracle Solaris Servers. Both DAC as well as Informatica are on single server. My business requirement calls for a frequent Data load into BI and Cache purge. i checked the forum and found so many articles on how to automate Purging of Cache Post ETL. I am successful in creating a script to purge the cache and i already tested it by executing the script manually. But when i call this script from a DAC task it fails. In order to make sure that there is no problem with the Script i created a simple script which just says "Hello" and tried to invoke the script from DAC task but failed.
    All Task Batches
    External Program Batch
      EXTERNAL PROGRAM TASKTest:/PurgeCache/CachePurge.sh:(Source : FULL Target : FULL)
      2013-10-13 17:40:38.015 Acquiring Resources
      2013-10-13 17:40:38.015 Acquired Resources
      2013-10-13 17:40:38.015 EXTERNAL PROGRAM TASKTest:/PurgeCache/CachePurge.sh:(Source : FULL Target : FULL) has started.
      ANOMALY INFO::: Error while executing : EXTERNAL PROGRAM TASKTest:/PurgeCache/CachePurge.sh:(Source : FULL Target : FULL)
      MESSAGE:::com.siebel.analytics.etl.execution.exceptions.ExternalProcessException:
      EXCEPTION CLASS::: java.lang.RuntimeException
      com.siebel.analytics.etl.etltask.GenericTaskImpl.doExecuteWithRetries(GenericTaskImpl.java:536)
      com.siebel.analytics.etl.etltask.GenericTaskImpl.execute(GenericTaskImpl.java:372)
      com.siebel.analytics.etl.etltask.GenericTaskImpl.execute(GenericTaskImpl.java:253)
      com.siebel.analytics.etl.etltask.GenericTaskImpl.run(GenericTaskImpl.java:655)
      com.siebel.analytics.etl.taskmanager.XCallable.call(XCallable.java:63)
      java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      java.util.concurrent.FutureTask.run(Unknown Source)
      java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      java.util.concurrent.FutureTask.run(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      java.lang.Thread.run(Unknown Source)
      ::: CAUSE :::
      MESSAGE :::
      EXCEPTION CLASS::: com.siebel.analytics.etl.execution.exceptions.ExternalProcessException
      com.siebel.analytics.etl.etltask.ExternalProgramTask.doExecute(ExternalProgramTask.java:99)
      com.siebel.analytics.etl.etltask.GenericTaskImpl.doExecuteWithRetries(GenericTaskImpl.java:477)
      com.siebel.analytics.etl.etltask.GenericTaskImpl.execute(GenericTaskImpl.java:372)
      com.siebel.analytics.etl.etltask.GenericTaskImpl.execute(GenericTaskImpl.java:253)
      com.siebel.analytics.etl.etltask.GenericTaskImpl.run(GenericTaskImpl.java:655)
      com.siebel.analytics.etl.taskmanager.XCallable.call(XCallable.java:63)
      java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      java.util.concurrent.FutureTask.run(Unknown Source)
      java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      java.util.concurrent.FutureTask.run(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      java.lang.Thread.run(Unknown Source)
      (Number of retries : 1)
      /PurgeCache/CachePurge.sh
      2013-10-13 17:40:38.031 EXTERNAL PROGRAM TASKTest:/PurgeCache/CachePurge.sh:(Source : FULL Target : FULL) has finished execution with Failed status.
    (Failed)
    Any help would be greatly appreciated.
    thanks and regards,
    Sree

    See the thread below:
    Re: FDM - Script

  • Executing a shell script from a java program

    Hi,
    I'm facing a problem while executing a shell script from a jsp page.
    I'm using exec() function.
    It's working fine for single statement scripts.But if the script consists of any database processing and some other processing statements,it's not returning the correct exit status of the process.
    Will u please help me in this.
    If there is any other ways to execute a shell script from a jsp page other than Runtime.exec().If so let me know.
    Thanks in advance.

    I think this shud workMaybe - but it is wrong! Why do you create aReader
    and then read bytes which are turned into a String
    without worrying about whether or not the bytes area
    String and without worrying about the character
    encoding if the bytes do represent characters and
    without worrying about how many bytes wereactually
    read.
    Also, both you and the OP should read, digest and
    follow the advice given in
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-
    traps.htmlI dont care if it is wrong. This code works for me.
    We are here to solve problems not to find which post
    is wrong.It is wrong! You are posting bad advice that is very wrong! It may work for you but it is wrong in general! WRONG WRONG WRONG.
    If you have a solution then post it I did post a solution! The reference I gave will explain to you and the OP exactly how it should be done.
    rather then
    posting rude comments.I was not rude! I was explaining just some of what was wrong!

  • Executing a Perl Script from within a Servlet

    I'm trying to call a script from within a servlet.This is the code i'm using:
    Process process = Runtime.getRuntime().exec(new String[]{"sh","-c",script,nick,pass});
    InputStream input = process.getInputStream();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    int i;
    while ((i=input.read())!=-1) {
    baos.write(i);
    System.out.println(baos.toString());
    I can`t make it work.This is the output i'm getting.
    java.io.IOException: CreateProcess: sh -c /home/script.sh user pass error=2
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.(Win32Process.java:66)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:551)
    at java.lang.Runtime.exec(Runtime.java:477)
    at java.lang.Runtime.exec(Runtime.java:443)
    at controllers.EmailAcountCreate.doPost(EmailAcountCreate.java:34)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    Thanks in advance.

    I am facing the same problem. Could you please post the answer if you have one now. Please treat this as very urgent.

  • 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

  • Automator: Create folder from suffix of filename and put file names with same suffix into folder

    I've been using a script to use automator to create a folder from the filename and put that file into it the folder just created.
    I have a bunch of files that have similar names to them, but I don't want every file to be put into its own folder, instead I want all files with the same suffix (001) to go into the same folder.  I would also like the folder name to just be named the same as the suffix (001) instead of the full file name.
    For example all of these files names that end with the same integer (001) should be dumped into the same folder named "001":
    Boston_ProRes422_1920x1080_24p_Audio_001
    Boston_ProRes422_3840x2160_24p_Audio_001
    Boston_ProRes422_3840x2160_24p_RAW_Audio_001
    Boston_ProRes422_1920x1080_24p_Audio_002
    Boston_ProRes422_1920x1080_24p_Audio_005
    Boston_ProRes422_1920x1080_24p_Audio_010
    Any help at all would be incredible!!
    Thanks!
    Here's the script I'm using right now:
    on run {input, parameters} -- create folders from file names and move
      set output to {} -- this will be a list of the moved files
      repeat with anItem in the input -- step through each item in the input
      set {theContainer, theName, theExtension} to (getTheNames from anItem)
      try
      set destination to (makeNewFolder for theName at theContainer)
      tell application "Finder"
      move anItem to destination
      set the end of the output to the result as alias -- success
      end tell
      on error errorMessage -- duplicate name, permissions, etc
      log errorMessage
      # handle errors if desired - just skip for now
      end try
      end repeat
      return the output -- pass on the results to following actions
    end run
    to getTheNames from someItem -- get a container, name, and extension from a file item
      tell application "System Events" to tell disk item (someItem as text)
      set theContainer to the path of the container
      set {theName, theExtension} to {name, name extension}
      end tell
      if theExtension is not "" then
      set theName to text 1 thru -((count theExtension) + 2) of theName -- just the name part
      set theExtension to "." & theExtension
      end if
      return {theContainer, theName, theExtension}
    end getTheNames
    to makeNewFolder for theChild at theParent -- make a new child folder at the parent location if it doesn't already exist
      set theParent to theParent as text
      if theParent begins with "/" then set theParent to theParent as POSIX file as text
      try
      return (theParent & theChild) as alias
      on error errorMessage -- no folder
      log errorMessage
      tell application "Finder" to make new folder at theParent with properties {name:theChild}
      return the result as alias
      end try
    end makeNewFolder

    Thanks Neil for the response! That script didn't work, but I did get it to work with my old script by changing "set TheName to" numbers different.  Here's my final script which creates folders named "001", "002", and so forth and dumps in the files that end in that same suffix in the matching folder.
    on run {input, parameters} -- create folders from file names and move
      set output to {} -- this will be a list of the moved files
      repeat with anItem in the input -- step through each item in the input
      set {theContainer, theName, theExtension} to (getTheNames from anItem)
      try
      set destination to (makeNewFolder for theName at theContainer)
      tell application "Finder"
      move anItem to destination
      set the end of the output to the result as alias -- success
      end tell
      on error errorMessage -- duplicate name, permissions, etc
      log errorMessage
      # handle errors if desired - just skip for now
      end try
      end repeat
      return the output -- pass on the results to following actions
    end run
    to getTheNames from someItem -- get a container, name, and extension from a file item
      tell application "System Events" to tell disk item (someItem as text)
      set theContainer to the path of the container
      set {theName, theExtension} to {name, name extension}
      end tell
      if theExtension is not "" then
      set theName to text -5 thru -((count theExtension) + 4) of theName -- just the name part
      set theExtension to "." & theExtension
      end if
      return {theContainer, theName, theExtension}
    end getTheNames
    to makeNewFolder for theChild at theParent -- make a new child folder at the parent location if it doesn't already exist
      set theParent to theParent as text
      if theParent begins with "/" then set theParent to theParent as POSIX file as text
      try
      return (theParent & theChild) as alias
      on error errorMessage -- no folder
      log errorMessage
      tell application "Finder" to make new folder at theParent with properties {name:theChild}
      return the result as alias
      end try
    end makeNewFolder

Maybe you are looking for

  • Charging with silicone case?

    Is it really a problem if charging the ipod mini in the silicone case? There's a slot for it at the bottom to plug in the cord, but looking at the ipod site, it says not to charge when it is in a cover or case. It is just a hassle to take off the sil

  • Removing the edit bar from the bottom of the page

    Hi, I have created a web application using HTML DB. Is there a way to remove the bottom bar which has link for editpage etc? Please help. Thanks, -anubhav

  • Photoshop CC file started to get corrupted

    Hi, I have a file I've been working on (Photoshop CC + OSX 10.9.1). These artifacts appear in some layers that have some effects on smart objects (but not limited too). I disabled gpu drawing, as it might be related - but the artifacts remain. Is the

  • Ibooks dictionary

    Don't know why but the dictionary in my iBooks won't download. Used to work perfectly with the last operating system. Help!

  • HT1918 There's no none option for my payment method ?d

    How come there's no "none " option for my payment method?