

--
--    Licensed Materials - Property of IBM
--    
--    BI and PM: JSM
--    
--    (c) Copyright IBM Corp. 2003, 2010.
--    
--    US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
--    


-------------------------------------------------------------------------------
-- NC305_UPDATE_ORA.SQL	       *DO NOT EDIT*		Data Store Version: 305		 
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$100-- backup create begin
-------------------------------------------------------------------------------

CREATE TABLE BC_TASK_QUEUE (
	TASK_ID 			CHAR(20) NOT NULL,
	SERVICE_NAME 		VARCHAR2(40) ,
	SERVER_GROUP 		VARCHAR2(40) ,
	DATE_ENTERED 		NUMERIC NOT NULL,
	TASK 				BLOB ,
	STATUS 				INTEGER NOT NULL,
	PRIORITY 			INTEGER NOT NULL,
	RESTART_ID          CHAR(20),
	SDS_INSTANCE_ID	 	CHAR (32) ,
	HISTORY_STORE_ID 	CHAR (34) 
);
-------------------------------------------------------------------------------
--$110-- backup inserts begin
-------------------------------------------------------------------------------

INSERT INTO BC_TASK_QUEUE ( TASK_ID ,SERVICE_NAME  ,SERVER_GROUP ,DATE_ENTERED,TASK  ,STATUS,PRIORITY ,SDS_INSTANCE_ID,HISTORY_STORE_ID )
    SELECT TASK_ID ,SERVICE_NAME  ,SERVER_GROUP ,DATE_ENTERED,TASK  ,STATUS,PRIORITY ,SDS_INSTANCE_ID,HISTORY_STORE_ID FROM NC_TASK_QUEUE;

-------------------------------------------------------------------------------
--$130-- views drop begin
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$140-- tables drop begin
-------------------------------------------------------------------------------

DROP TABLE NC_TASK_QUEUE;


-------------------------------------------------------------------------------
--$200-- recreate tables begin
-------------------------------------------------------------------------------


CREATE TABLE NC_TASK_QUEUE (
	TASK_ID 			CHAR(20) NOT NULL,
	SERVICE_NAME 		VARCHAR2(40) ,
	SERVER_GROUP 		VARCHAR2(40) ,
	DATE_ENTERED 		NUMERIC NOT NULL,
	TASK 				BLOB ,
	STATUS 				INTEGER NOT NULL,
	PRIORITY 			INTEGER NOT NULL,
	RESTART_ID    	    CHAR (20),
	SDS_INSTANCE_ID	 	CHAR (32) ,
	HISTORY_STORE_ID 	CHAR (34) 
);


CREATE TABLE NC_TASK_PROPERTY (
	TASK_ID 			CHAR (20) NOT NULL,
	PROP_NAME			CHAR (20),
	PROP_VALUE			VARCHAR2(2000)
);
-------------------------------------------------------------------------------
--$202-- primary keys add begin
-------------------------------------------------------------------------------
ALTER TABLE NC_TASK_QUEUE ADD CONSTRAINT PN_TASK_QUEUE PRIMARY KEY (TASK_ID);

CREATE INDEX X_NC_TASK_QUEUE_SLTR ON NC_TASK_QUEUE (
	RESTART_ID);

ALTER TABLE NC_TASK_PROPERTY ADD CONSTRAINT PN_TASK_PROPERTY PRIMARY KEY (TASK_ID);

CREATE INDEX IX_NC_TASK_QUEUE_SLTR ON NC_TASK_QUEUE (
	STATUS, SERVICE_NAME, SERVER_GROUP, DATE_ENTERED);

-------------------------------------------------------------------------------
--$210-- views create begin
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$220-- server data inserts begin
-------------------------------------------------------------------------------

INSERT INTO NC_DB_VERSION (DB_VERSION_ID,BUILD) VALUES(305,'build no.');


 -------------------------------------------------------------------------------
 --$230-- restore inserts begin
 -------------------------------------------------------------------------------

INSERT INTO NC_TASK_QUEUE ( TASK_ID ,SERVICE_NAME  ,SERVER_GROUP ,DATE_ENTERED,TASK  ,STATUS,PRIORITY ,SDS_INSTANCE_ID,HISTORY_STORE_ID )
    SELECT TASK_ID ,SERVICE_NAME  ,SERVER_GROUP ,DATE_ENTERED,TASK  ,STATUS,PRIORITY ,SDS_INSTANCE_ID,HISTORY_STORE_ID FROM BC_TASK_QUEUE;
 -------------------------------------------------------------------------------
 --$250-- backup drop begin
 -------------------------------------------------------------------------------

DROP TABLE BC_TASK_QUEUE;

-------------------------------------------------------------------------------
--$260-- end sql by function
-------------------------------------------------------------------------------
--	END NC305_UPDATE_ORA.SQL			*	DO NOT EDIT	 * 		 
-------------------------------------------------------------------------------
