Add token db restoration scripts

master
prathabanKavin 11 months ago
parent 71234c0301
commit 1c23e3d615

@ -0,0 +1,29 @@
-- BACKUP bst_mdmapim db
BACKUP DATABASE bst_mdmapim TO DISK = N'/opt/entgra/dbdump/bst_mdmapim.bak' WITH NOFORMAT, NOINIT, NAME = N'BSTMDMAPIM-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10;
--Token db creation--
-- 01. drop apim tables /tokendb/drop-apim-tables.sql
-- 02. backup token table
BACKUP DATABASE bst_mdmapim TO DISK = N'/opt/entgra/dbdump/bst_token.bak' WITH NOFORMAT, NOINIT, NAME = N'BSTTOKEN-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10;
-- 03. restore token db
/*
-- Enable contained database authentication
sp_configure 'contained database authentication', 1;
GO
RECONFIGURE;
GO
*/
RESTORE DATABASE bst_tokendb FROM DISK = '/opt/entgra/dbdump/bst_token.bak' WITH MOVE 'bst_tokendb' TO '/opt/entgra/dbdump/bst_tokendb.mdf', MOVE 'bst_tokendb_log' TO '/opt/entgra/dbdump/bst_tokendb_log.ldf', REPLACE, RECOVERY, STATS = 5;
--IDP restoration--
-- 01. Restore bst_mdmapim
RESTORE DATABASE bst_mdmapim FROM DISK = '/opt/entgra/dbdump/bst_mdmapim.bak' WITH MOVE 'bst_mdmapim' TO '/opt/entgra/dbdump/bst_mdmapim.mdf', MOVE 'bst_mdmapim_log' TO '/opt/entgra/dbdump/bst_mdmapim_log.ldf', NOUNLOAD, STATS = 5;
-- 02. drop all other tables /idp-restoration/drop-apim-tables.sql

@ -0,0 +1,120 @@
-- add check for if exists delete database
USE bst_mdmapim;
GO
drop table SP_FEDERATED_IDP;
drop table AM_API_SCOPES;
drop table SP_CLAIM_MAPPING;
drop table IDN_CLAIM_MAPPED_ATTRIBUTE;
drop table AM_API_DEFAULT_VERSION;
drop table AM_ALERT_TYPES;
drop table IDN_CLAIM_PROPERTY;
drop table SP_ROLE_MAPPING;
drop table AM_ALERT_TYPES_VALUES;
drop table SP_REQ_PATH_AUTHENTICATOR;
drop table AM_ALERT_EMAILLIST;
drop table AM_API_DEFAULT_VERSION;
drop table IDN_CLAIM_MAPPING;
drop table SP_PROVISIONING_CONNECTOR;
drop table AM_ALERT_EMAILLIST_DETAILS;
drop table AM_POLICY_SUBSCRIPTION;
drop table IDN_SAML2_ASSERTION_STORE;
drop table IDN_OIDC_JTI;
drop table SP_AUTH_SCRIPT;
drop table IDN_OIDC_PROPERTY;
drop table IDN_OIDC_REQ_OBJECT_REFERENCE;
drop table AM_POLICY_APPLICATION;
drop table IDN_OIDC_REQ_OBJECT_CLAIMS;
drop table IDN_BASE_TABLE;
drop table IDN_OIDC_REQ_OBJ_CLAIM_VALUES;
drop table AM_POLICY_HARD_THROTTLING;
drop table IDN_CERTIFICATE;
drop table IDN_OAUTH2_SCOPE_VALIDATORS;
drop table IDN_OAUTH1A_REQUEST_TOKEN;
drop table AM_CONDITION_GROUP;
drop table CM_PURPOSE_CATEGORY;
drop table IDN_OAUTH1A_ACCESS_TOKEN;
drop table AM_QUERY_PARAMETER_CONDITION;
drop table CM_RECEIPT_SP_ASSOC;
drop table AM_HEADER_FIELD_CONDITION;
drop table CM_SP_PURPOSE_ASSOC;
drop table IDN_OAUTH2_AUTHORIZATION_CODE;
drop table AM_JWT_CLAIM_CONDITION;
drop table CM_SP_PURPOSE_PURPOSE_CAT_ASSC;
drop table IDN_OAUTH2_ACCESS_TOKEN_SCOPE;
drop table CM_PURPOSE_PII_CAT_ASSOC;
drop table IDN_OAUTH2_SCOPE;
drop table AM_IP_CONDITION;
drop table CM_SP_PURPOSE_PII_CAT_ASSOC;
drop table IDN_OAUTH2_SCOPE_BINDING;
drop table IDN_OAUTH2_RESOURCE_SCOPE;
drop table AM_POLICY_GLOBAL;
drop table CM_CONSENT_RECEIPT_PROPERTY;
drop table IDN_SCIM_GROUP;
drop table IDN_OPENID_REMEMBER_ME;
drop table AM_THROTTLE_TIER_PERMISSIONS;
drop table AM_BLOCK_CONDITIONS;
drop table IDN_OPENID_USER_RPS;
drop table IDN_ASSOCIATED_ID;
drop table AM_API;
drop table IDN_OPENID_ASSOCIATIONS;
drop table AM_CERTIFICATE_METADATA;
drop table IDN_USER_ACCOUNT_ASSOCIATION;
drop table AM_API_URL_MAPPING;
drop table FIDO_DEVICE_STORE;
drop table AM_APPLICATION_GROUP_MAPPING;
drop table IDN_STS_STORE;
drop table AM_SUBSCRIPTION;
drop table WF_REQUEST;
drop table AM_USAGE_UPLOADED_FILES;
drop table IDN_IDENTITY_USER_DATA;
drop table WF_BPS_PROFILE;
drop table IDN_IDENTITY_META_DATA;
drop table AM_SUBSCRIPTION_KEY_MAPPING;
drop table WF_WORKFLOW;
drop table AM_API_LC_PUBLISH_EVENTS;
drop table IDN_THRIFT_SESSION;
drop table AM_APPLICATION_KEY_MAPPING;
drop table WF_WORKFLOW_ASSOCIATION;
drop table IDN_AUTH_SESSION_STORE;
drop table AM_APPLICATION_REGISTRATION;
drop table WF_WORKFLOW_CONFIG_PARAM;
drop table WF_REQUEST_ENTITY_RELATIONSHIP;
drop table AM_API_LC_EVENT;
drop table AM_APP_KEY_DOMAIN_MAPPING;
drop table WF_WORKFLOW_REQUEST_RELATION;
drop table AM_API_COMMENTS;
drop table SP_METADATA;
drop table IDN_RECOVERY_DATA;
drop table AM_API_RATINGS;
drop table SP_INBOUND_AUTH;
drop table AM_TIER_PERMISSIONS;
drop table IDN_PASSWORD_HISTORY_DATA;
drop table SP_AUTH_STEP;
drop table AM_EXTERNAL_STORES;
drop table IDN_CLAIM_DIALECT;
drop table AM_WORKFLOWS;
drop table IDN_CLAIM;
drop table IDN_OAUTH_CONSUMER_APPS;
drop table CM_PII_CATEGORY;
drop table AM_API_THROTTLE_POLICY;
drop table CM_RECEIPT;
drop table CM_PURPOSE;
drop table AM_APPLICATION;
drop table AM_SUBSCRIBER;
drop table SP_APP;
drop table IDP_LOCAL_CLAIM;
drop table IDP_PROVISIONING_ENTITY;
drop table IDP_PROV_CONFIG_PROPERTY;
drop table IDP_PROVISIONING_CONFIG;
drop table IDP_AUTHENTICATOR_PROPERTY;
drop table IDP_METADATA;
drop table IDP_AUTHENTICATOR;
drop table IDP_CLAIM_MAPPING;
drop table IDP_CLAIM;
drop table IDP_ROLE_MAPPING;
drop table IDP;
GO

@ -30,6 +30,12 @@ DELIMITER ;
CALL ALTER_UM_USER();
*/
ALTER TABLE UM_USER ADD COLUMN UM_USER_ID CHAR(36) NOT NULL DEFAULT 'NONE';
UPDATE UM_USER SET UM_USER_ID = UUID();
ALTER TABLE UM_USER ADD UNIQUE(UM_USER_ID, UM_TENANT_ID);
CREATE TABLE IF NOT EXISTS UM_HYBRID_GROUP_ROLE(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_GROUP_NAME VARCHAR(255),
@ -70,6 +76,7 @@ CALL skip_index_if_exists('UM_ATTR_NAME_VALUE_INDEX','UM_USER_ATTRIBUTE','(UM_AT
DROP PROCEDURE IF EXISTS skip_index_if_exists;
*/
CREATE INDEX UM_ATTR_NAME_VALUE_INDEX ON UM_USER_ATTRIBUTE (UM_ATTR_NAME, UM_ATTR_VALUE);
ALTER TABLE UM_TENANT ADD COLUMN UM_TENANT_UUID VARCHAR(36) NOT NULL;

Loading…
Cancel
Save