Skip to main content
Delphix

Enable MSSQL dSource Fails Because a Database With the Same Name as the Staging Database Already Exists (KBA1499)

 

 

Note

Note:

This topic has been Retired as the issue was fixed in 4.1.4.0.

Applicable Delphix Versions

 

Major Release

All Sub Releases

4.1

4.1.0.0, 4.1.2.0, 4.1.3.0, 4.1.3.1, 4.1.3.2

4.0

4.0.0.0, 4.0.0.1, 4.0.1.0, 4.0.2.0, 4.0.3.0, 4.0.4.0, 4.0.5.0, 4.0.6.0, 4.0.6.1

3.2

3.2.0.0, 3.2.1.0, 3.2.2.0, 3.2.2.1, 3.2.3.0, 3.2.4.0, 3.2.4.1, 3.2.4.2, 3.2.5.0, 3.2.5.1, 3.2.6.0, 3.2.7.0, 3.2.7.1

3.1

3.1.0.1, 3.1.1.0, 3.1.2.0,  3.1.2.1, 3.1.3.0 , 3.1.3.1, 3.1.3.2, 3.1.4.0, 3.1.5.0, 3.1.6.0

Problem

Prior to Delphix Engine 4.1.4.0, attempts to enable a dSource in a Microsoft SQL server environment may fail with the error:

a database with the same name as the staging database "X" already exists

Symptoms

Attempts to enable a dSource in a Microsoft SQL Server environment fail with staging database with same name "already exists". 

This action (attempt to enable dSource) and this failure (already exists) are key to matching bug DLPX-31219 and providing quick resolution.

Confirm the symptoms and work to solution:

(i) In browser review failed jobs:  "Job 1234: Enable database source ... failed"

(ii) Details of the failed job will show:

"Database source ... could not be enabled because a database with the same name as the staging database "4206a0a8-7f5f-fbea-031e-fbf09331383a-staging-1" already exists on instance "MSSQLSERVER" on staging host "DC01DLPXDBDV33".

 

(iii) Open the dSource card and look at the "staging environment". Hover the mouse over this for the full name. In our case the full name is "4206a0a8-7f5f-fbea-031e-fbf09331383a-staging-1"

(iv) debug.log, this is optional as the symtoms "customer tried to enable dSource" and this failed with "already exists" is sufficient. Stack will appear as follows:

[2014-11-19 14:40:23,502][ERROR][wms.impl.WorkerManagerImpl#recordFailure:442][Worker-10903] worker 10903 com.delphix.appliance.server.jcm.impl.JobLauncher: failed.
exception.db.mssqlstagingdb.stagingdb.exists
        at com.delphix.appliance.server.exception.DelphixUserException.logMe(DelphixUserException.java:63)
        at com.delphix.appliance.server.exception.DelphixUserException.<init>(DelphixUserException.java:102)
        at com.delphix.appliance.server.dco.events.enums.DbMssqlstagingdbExceptions$StagingdbExists.<init>(DbMssqlstagingdbExceptions.java:297)
        at com.delphix.appliance.server.mssql.staging.MSSqlStagingSourceEnableJob.setupStagingDB(MSSqlStagingSourceEnableJob.java:70)
        at com.delphix.appliance.server.mssql.staging.MSSqlStagingSourceEnableJob.execute(MSSqlStagingSourceEnableJob.java:150)
        at com.delphix.appliance.server.mssql.staging.MSSqlStagingDatabaseManagerImpl.enable(MSSqlStagingDatabaseManagerImpl.java:401)
        ... 6 more
        at com.sun.proxy.$Proxy50.enable(Unknown Source)
        at com.delphix.appliance.server.db.executor.BaseSourceProviderImpl.enable(BaseSourceProviderImpl.java:175)
        at com.delphix.appliance.server.lifecycle.impl.SourceManagerImpl$1.execute(SourceManagerImpl.java:340)
        at com.delphix.appliance.server.dco.jobs.JobInstance.execute(JobInstance.java:159)
        at com.delphix.appliance.server.jcm.impl.JobManagerImpl.runJob(JobManagerImpl.java:339)
        at com.delphix.appliance.server.jcm.impl.JobLauncher.execute(JobLauncher.java:34)
        at com.delphix.appliance.server.wms.impl.WorkerManagerImpl.run(WorkerManagerImpl.java:421)
        at com.delphix.appliance.server.wms.impl.WorkerControl.run(WorkerControl.java:105)
 

(v) Do due diligence and rule out some unusual other issue: 

  • Check the status of the staging server using SQL Server Management Studio. Confirm the staging server status as "Restoring..."
  • Check the mount point implied in the error message using the Delphix connector links. Check the device is mounted. In this example we'd need to check:

    D:\Program Files\Delphix\DelphixConnector\4206a0a8-7f5f-fbea-031e-fbf09331383a-staging-1

    If this is not mounted then the problem is a different one.

Resolution

To confirm and remediate the issue from an MDS perspective: Find the container_id and container_name:

hercules=> select container_id,container_type from dlpx_container where name = 'QNXT_PLANDATA_MI_REB' ;
 container_id |   container_type   
--------------+--------------------
            1 | MSSQL_DB_CONTAINER
(1 row)
 

Using the container_name find the staging_source:

hercules=> select staging_source from mssql_linked_source where container = 'MSSQL_DB_CONTAINER-1' ;
     staging_source     
------------------------
 MSSQL_STAGING_SOURCE-1
(1 row)
 

Using the staging_source, cross-check / confirm the "enabled" state and the mount base with what is visible in the browser:

hercules=> select staging_db_id,enabled,mount_base from mssql_staging_source where staging_db_id = 1 ;
 staging_db_id | enabled |                                        mount_base                                        
---------------+---------+------------------------------------------------------------------------------------------
             1 | f       | D:\Program Files\Delphix\DelphixConnector\4206a0a8-7f5f-fbea-031e-fbf09331383a-staging-1
(1 row)

 

If you confirmed diagnosis

(i) Update MDS:

hercules=> update  mssql_staging_source set enabled = 't' where staging_db_id = 1 ;

NOTE: if the DE is running 3.x set enabled to 1 rather than 't'

(ii) Validate the change:

 hercules=> select staging_db_id,enabled,mount_base from mssql_staging_source where staging_db_id = 1 ;
 staging_db_id | enabled |                                        mount_base                                        
---------------+---------+------------------------------------------------------------------------------------------
             1 | t       | D:\Program Files\Delphix\DelphixConnector\4206a0a8-7f5f-fbea-031e-fbf09331383a-staging-1
(1 row)
 

(iii) Enable the dSource using the browser interface

Additional Information

This issue is described in bug DLPX-31219 ("dsource failing staging db already exists"). It was fixed in 4.2 and backported to 4.1.4.0.