Getting started with Cloud DB for MSSQL
    • PDF

    Getting started with Cloud DB for MSSQL

    • PDF

    Article Summary

    The latest service changes have not yet been reflected in this content. We will update the content as soon as possible. Please refer to the Korean version for information on the latest updates.

    Available in VPC

    Getting started with Cloud DB for MSSQL describes what you need to do to properly use Cloud DB for MSSQL after checking the Cloud DB for MSSQL user environment and supported specifications and fully understanding the Overall usage scenarios and Glossary. The following is the content dealt with in Getting started with Cloud DB for MSSQL.

    • How to create an application server from the NAVER Cloud Platform console
    • How to test application server connection
    • How to create MSSQL servers from the NAVER Cloud Platform console
    • How to test MSSQL server connection

    If you completed the above, then you've completed the basic procedure for using Cloud DB for MSSQL. Afterward, you have the option of proceeding with the following tasks for more efficient server management and operation.

    • Event and notification (alarm) settings using NAVER Cloud Platform's Cloud Insight
    • Management of administration permissions using NAVER Cloud Platform's Sub Account

    The above tasks can be done from Cloud Insight or Sub Account after subscribing, rather than in Cloud DB for MSSQL. They are not explained in detail in this guide. For more information, see Cloud Insight user guide and Sub Account user guide.

    Create application server

    To create an application server from the NAVER Cloud Platform console, follow these steps:

    Note

    In this section, we will briefly introduce how to create an application server. For more information on full creation methods, see Server user guide.

    1. From the VPC environment of the NAVER Cloud Platform console, click Services > Compute > Server, in order.
    2. Click the [Create server] button.
    3. Click to select a Windows server image and click the [Next] button.
    4. Enter the required information, and then click the [Next] button.
    5. If you do not have an existing authentication key, then create a new authentication key and click the [Next] button.
    6. If you do not have any ACG, create a new one.
    7. After the final confirmation, click the [Create server] button.
    Caution
    • Select a server image with the Windows type from Step 3 for remote desktop connection.
    • The ACG name of the application server from Step 6 is used when adding ACG to the MSSQL server later on.

    Set access environment

    To set up a server access environment in the VPC environment of the NAVER Cloud Platform console, you need to set up a public IP.

    Note

    In this section, we will briefly introduce how to set up the access environment. For more information on setting up the access environment, see the following guide.

    Set public IP

    To set up a public IP, follow these steps:

    1. From the VPC environment of the NAVER Cloud Platform console, click Services > Compute > Server, in order.
    2. Click the Public IP menu.
    3. Click the [Request public IP] button.
    4. Select the target server, enter a memo, and then click the [Next] button.
    5. Click the [Create] button.

    Get admin password

    To get the admin (root) password required for accessing the application server after setting up the public IP, follow these steps:

    1. From the VPC environment of the NAVER Cloud Platform console, click Services > Compute > Server, in order.
    2. Click the [Manage servers and change settings] button, and then click the Get admin password menu.
    3. Enter the authentication key generated while creating the server.
    4. Click the [Get password] button.
    5. Check the password.

    Test application server connection

    To test if you can properly connect to the application server using a remote desktop connection, follow these steps:

    1. Click Start > All Programs > Accessories > Remote Desktop Connection, in order.
    2. Enter the public IP for server connection in Computer.
      clouddbformssql-start-appconnect_vpc_ko
    3. Click the [Connect] button.
    4. When the user credential input pop-up window appears, enter the ID and password you got from Get admin password.
      clouddbformssql-start-appconnect2_vpc_ko
    5. Click the [OK] button.
    6. When the Remote desktop connection warning window appears, click the [Yes] button.
      clouddbformssql-start-appconnect3_vpc_ko
    Note

    You can change the password through Ctrl + Alt + End > Change Password.

    Create MSSQL server

    Some of the services provided by NAVER Cloud Platform require you to go through the subscription procedure from the console before the start of actual usage. However, for Cloud DB for MSSQL, you can start using it upon creation of an MSSQL server without a separate subscribe step. To create an MSSQL server from the NAVER Cloud Platform console, follow these steps:

    Note
    • In this section, we will briefly introduce how to create a DB server. For more information on full creation methods, see Create MSSQL server.
    • Since an additional subscribe step does not exist for Cloud DB for MSSQL, an additional unsubscribe step also does not exist. If you want to stop using Cloud DB for MSSQL and prevent charges from incurring, then delete the MSSQL servers you created and were running. To delete MSSQL server, see Delete MSSQL server.
    1. From the VPC environment of the NAVER Cloud Platform console, click Services > Database > Cloud DB for MSSQL, in order.
    2. Click the DB server menu.
    3. Click the [Create DB server] button.
    4. When the subscribe page appears, enter the required information and click the [Next] button.
    5. Click the [Create] button.

    Set ACG

    To set up Access Control Group (ACG) for MSSQL servers from the NAVER Cloud Platform console, follow these steps:

    Note

    In this section, we will briefly introduce how to set up ACG. For more information on how to set up ACG, see ACG user guide.

    1. From the VPC environment of the NAVER Cloud Platform console, click Services > Database > Cloud DB for MSSQL, in order.
    2. Click the ACG menu.
      clouddbformssql-start_acg_vpc_ko
    3. Click and select the ACG to set up, and then click the [Set ACG] button.
      • Select the ACG of the MSSQL server automatically created
    4. Enter the ACG name of the application server in Access source.
    5. Enter the port number in Allowed port.
    6. Click the [Add] button.
    7. Click the [Apply] button.

    Test MSSQL server connection

    To test if you can connect properly to the created MSSQL server by installing the MSSQL client, follow these steps:

    1. Check the DNS name, DB access port, account ID, and password information for the MSSQL server access.
      • Click Services > Database > Cloud DB for MSSQL > DB server.
      • Click the MSSQL server's service name to access, and check the following:
        • DNS name: check Private domain
        • DB access port: check DB access port
      • Check the account ID and password from [Manage DB] > Manage DB user.
    2. Access the application server, Download SSMS, and install it.
    3. Connect to SSMS.
    4. Enter the DB server information in the server connection pop-up window.
      database-9-1-501_ko
      • Server type: database engine
      • Server name: DNS name, DB access port (separated with comma)
        • DNS name: private domain of the MSSQL server to access
        • DB access port: access port of the MSSQL server to access
      • Authentication: SQL server authentication
      • Login: account name of the user for the MSSQL server to access
      • Password: account password of the user for the MSSQL server to access
    5. Click the [Connect] button.

    Data migration (backup/recovery)

    In order to migrate the database operated on-premise to Cloud DB for MSSQL (CDB-MSSQL) or move it from CDB-MSSQL to on-premise, you need to create a window application server. Data migration is performed using the backup and recovery of the SQL server, and you can either proceed with it after uploading the database operated on-premise on the application server or backup the CDB-MSSQL to the application server.

    Note
    • The application server has to be in the same VPC network environment as CDB-MSSQL.
    • For recovering the backup using the application server, you need to set "password protected sharing off" at the network and sharing center of the application server.
    • Properly setting the ACG is required to protect the data of the application server. (Application server TCP Port 445 must be open.)
    1. Create application server
      • Check VPC and subnet of the CDB-MSSQL
        clouddbformssql-start-vpc_backup

      • Check VPC and Subnet of the application server
        clouddbformssql-start-vpc_appserver

      • After creating the backup folder on the created application server, set sharing (Everyone, Read/Write)
        clouddbformssql-start-vpc_backup-everyone

      • Turn off the password protected sharing

        • Control Panel > Network and Internet > Network and Sharing Center > Advanced sharing settings
        • Password protected sharing option > Select Turn off password protected sharing > Apply
          clouddbformssql-start-vpc_password-setting
    • Set ACG of the application server
      • The inbound port 445 of the application server should be open to VPC bandwidth.
        clouddbformssql-start-vpc_appserver-agc-setting_1
    • Set the MSSQL Server's ACG
      • The outbound port 445 of the MSSQL server must be open to the VPC range.
        clouddbformssql-start-vpc_appserver-agc-setting_2
    1. Backup (sample)

      backup database testdb to disk ='\\10.0.1.9\backup\testdb.bak'
      

      database-mssql-backup-sample_en

    2. Recovery (sample)

      • When restoring the database, you should recover it to d:\data folder. The database recovered to other directories does not guarantee stability.
      restore database testdb2 from disk ='\\10.0.1.9\backup\testdb.bak'
      with
        move 'testdb' to 'd:\data\testdb2.mdf',
        move 'testdb-log' to 'd:\data\testdb2_log.ldf'
      

      clouddbformssql-start-vpc_restore_en

    Caution
    • The on-premise recovery target database must be backed up with the CDB-MSSQL administrator account as the database owner before it can be used normally.
    • Even if the on-premise and CDB-MSSQL user accounts are the same, if the SIDs are different, the database cannot be used after recovery.
    • See the following script to set the SIDs to be the same and then back up from on-premise and restore to CDB-MSSQL.

    Troubleshooting SID problems

    This guide walks you through troubleshooting issues due to SID inconsistency in data migration (backup/recovery).

    1. Restore by changing db_owner in the original server (ON-PREMISE → CDB-MSSQL)
    Task ServerExecution script descriptions and references T-SQL Query
    CDB-MSSQL
  • Verify the SID with the following T-SQL command. Assume the default administrator account you created is dbuserid.
      SELECT SID FROM master.sys.sql_logins WHERE name='dbuserid'
  • Result example
      0xDBB5F4FE1DBC594FBF806E807AFE72D6
  • ON-PREMISE
  • Create a login to the local target server that the user wants to migrate to using the following command. Your password does not need to be the same.
      CREATE LOGIN [dbuserid] WITH PASSWORD = 'P@ssw0rd', SID =0xDBB5F4FE1DBC594FBF806E807AFE72D6, DEFAULT_DATABASE=[master], CHECK_POLICY=OFF, CHECK_EXPIRATION=OFF
  • Grant sysadmin permissions to the existing database owner to prevent errors from occurring when the owner changes.
  • In the migration target database [userdatabase], change the database owner to the user created above.
  • On the local target server, access the SA or administrator account and perform the following commands.
      USE [userdatabase]
      GO
      EXEC sp_changedbowner 'dbuserid'
      GO
  • Back up the database to be migrated.
      BACKUP DATABASE [userdatabase] TO disk = 'C:\temp\userdatabase.full'
    • Move the backed up database backup file to an application server created on the same VPC band.
  • CDB-MSSQL
  • Check the list of files before restoring. (If the application server VPC IP you created is 10.0.0.7.)
      RESTORE filelistonly FROM dist='\\10.0.0.7\backup\userdatabase.full'
  • Restore the database to the d:\database folder based on the list of verified files.
  • If a file with the same name exists, an error may occur.
      RESTORE DATABASE userdatabase FROM disk='\\\10.0.0.7\backup\userdatabase.full'
      with
      MOVE 'userdatabase' TO 'd:\data\userdatabase.mdf', MOVE 'userdatabase_log' TO 'd:\data\userdatabase.log.ldf'
    1. Add db_owner to the server to be recovered (CDB-MSSQL → CDB-MSSQL)
    Task content, server, and userExecution script descriptions and references T-SQL Query
  • Check AServerAdmin SID
  • Run as AServerAdmin in the original server (AServer)
  • Run as AServerAdmin in the original server (Aserver) to check SID.
      SELECT SID FROM master.sys.sql_logins WHERE name='AServerAdmin'
  • Result example
      0xB1CFFCE0AEF0234FB49273E7DD713FFA
  • Restore AServerDB
  • Run as BServerAdmin in the server to be recovered (BServer)
  • See Getting started with Cloud DB for MSSQL
      RESTORE DATABASE AServerDB FROM DISK='remote path'
  • Create AServerAdmin in BServer in the same way as AServerAdmin's SID
  • Run BServerAdmin in the server to be recovered (BServer)
  • You may use a different password from Aserver.
      CREATE LOGIN [AServerAdmin] WITH PASSWORD='P@ssw0rd', SID=0xB1CFFCE0AEF0234FB49273E7DD713FFA, DEFAULT_DATABASE=[master], CHECK_POLICY=OFF, CHECK_EXPIRATION=OFF
      GO
  • Grant the BServerAdmin db_owner authority for the AServerDB recovered in BServer
  • Run as AServerAdmin in the server to be recovered (BServer)
  • USE AserverDB
    GO
    CREATE USER BServerAdmin FOR LOGIN BServerAdmin
    GO
    ALTER ROLE [db_owner] ADD MEMBER BServerAdmin
    GO
  • Delete the temporary AServerAdmin in the BServer
  • Login as BServerAdmin in Bserver and run
  • Kill all SPIDs queried with the SELECT SPID FROM sysprocesses WHERE loginame = 'AServerAdmin' command and delete AServerAdmin.
      DROP LOGIN [AServerAdmin]
      GO
  • Note

    If the database is unavailable due to a mismatched SID, you can delete the database from the console.


    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.