Database Setup
  • 09 Aug 2024
  • 2 Minutes to read
  • PDF

Database Setup

  • PDF

Article summary

Database Setup

Setting up the Database involves steps to ensure that the database is properly configured, secured and ready to support the application's data storage and retrieval needs. The Database setup consists of the following steps. 

1. Login to the database server. 

2. Create a DB backup from the blob for which the QA has given the signoff. 

Restore Database

3. Go to Microsoft SQL Server Management Studio (SSMS), right click on Database and click Restore Database

Figure: SSMS

4. Select the path of the backup file under Device. Provide the Database name as per the instance name. Click OK and the Database is created. 

Figure: Restore Database

5. When restored, we get the following message. Refresh the Database to see if the database has been restored. 

Figure: Message

Create User and map to Database


6. Create a user (new login for the newly created instance). Right click on Security > Logins.

7. Under the General page, provide a valid Login name, select SQL Server authentication, and provide a Password.

8. Under Server Roles page, enable the checkbox for public.

9. Under User Mapping, select the database under Users mapped to this login and select db_owner under Database role membership. Click OK

Update URL and Vault


10. URL Change scripts is available in Blob. Perform URL changes by executing this script when setting up a new instance.

11.  Update Vault details and DB connection string details by executing the script provided in the Plt_app_setting. 

Note
Vault name is created while setting up the application (angular and core). It has to be the same while updating vault details like Vault Name, Token, and Vault Endpoint URL and DB Connection string. 

To know more about URL change script, refer to URL Change Script

To know more about Dynamic Query to Update Vault, refer to Dynamic Query to Update Vault.

Note
The server IP depends on the host IP where the server is running. It may from customer to customer. 

Generate a Password and assign to User

12. Run the query "select * from plt_users where email_id like'%Fred$'. 

13, Select the run and run the query 'update plt_users set password = 'xx' where id = 143;"

Create Maintenance Jobs 

14. Create the job on the preinstalled System Stored Procedures on Create Missing Index, Maintenance, and Update Statistics

Note
Ensure that the database name (SQL login name) and login name are entered correctly.

15. Right-click on System Stored procedure Maintenance > Properties > Steps > Delete AG_Check. 

To know more about USP DB Maintenance, Update Statistics and Missing Index, refer to USP DB Maintenance, Update Statistics and Missing Index.

Create a Missing Job Index 

16. To create the Missing Index job, right-click Jobs > New Job.

17. Enter the Name for the Missing Index. 

18. In the Steps page, provide a Step Name. Select the Database on which it needs to run and type 'EXEC dbo.USP_CREATEMISSINGINDEX GO' in the Command. Click OK. 

19. Go to Schedule > New. Provide the Name and set up Frequency and Daily Frequency timings. Click OK

Run the Jobs 

To run the newly created Maintenance and Missing Job Index, perform the following steps. 

20. Right-click the Jobs > Start Job at Step.

Note
Ensure SQL Server Agent is running in the services. 

Was this article helpful?

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.