21
Authored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data-Base Backup and Restore

Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

  • Upload
    vukhue

  • View
    222

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

Authored by: AVINASH KUMAR SINGH

COMPANY: PAXCEL TECHNOLOGIES PVT.LTD

Microsoft SQL Server Analysis

Services

Analysis Services Data-Base Backup and Restore

Page 2: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

1

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

ANALYSIS SERVICE SHORT INTRODUCTION

Analysis Services is an online analytical processing (OLAP) database, a type of database that is highly

optimized for the kinds of queries and calculations that are common in a business intelligence

environment. It does many of the same things that a relational database can do, but it differs from a

relational database in many respects. In most cases, it will be easier to develop your BI solution by using

Analysis Services in combination with a relational database such as Microsoft SQL Server than by using

SQL Server alone. Analysis Services certainly does not replace the need for a relational database or a

properly designed data warehouse.

SQL SERVER ANALAYSIS SERVICES DATABASE BACKUP

Administrators can back up an Analysis Services database to a single Analysis Services backup file (.abf),

regardless of size of the database. If the Analysis Services database contains remote partitions, the

remote partitions can also be backed up. When you back up a database with remote partitions, all the

remote partitions on each remote server are backed up to a single file on each of those remote servers

respectively. Therefore, if you want to create those remote backups off their respective host computers,

you will have to manually copy those files to the designated storage areas.

Backing up an Analysis Services database produces a backup file whose contents vary depending upon

the storage mode used by the database objects. This difference in backup content results from the fact

that each storage mode actually stores a different set of information within an Analysis Services

database. For example, multidimensional hybrid OLAP (HOLAP) partitions and dimensions store

aggregations and metadata in the Analysis Services database, while relational OLAP (ROLAP) partitions

and dimensions only store metadata in the Analysis Services database.

Because the actual contents of an Analysis Services database vary based on the storage mode of each

partition, the contents of the backup file also vary. The following table associates the contents of the

backup file to the storage mode used by the objects.

Storage Mode Contents of backup file

Multidimensional MOLAP partitions and

dimensions

Metadata, source data, and aggregations

Multidimensional HOLAP partitions and

dimensions

Metadata and aggregations

Multidimensional ROLAP partitions and

dimensions Metadata

Tabular In-Memory Models Metadata and source data

Tabular Direct-Query Models Metadata only

NOTE

Backing up an Analysis Services database does not back up the data in any underlying data sources, such

as a relational database. Only the contents of the Analysis Services database are backed up.

Page 3: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

2

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

When you back up an Analysis Services database, you can choose from the following options:

Whether to compress all database backups. The default is to compress backups.

Whether to encrypt the contents of the backup files and require a password before the file

can be unencrypted and restored. By default, the backed up data is not encrypted.

Restoring an Analysis Services Database

Administrators can restore an Analysis Services database from one or more backup files.

Note

If a backup file is encrypted, you must provide the password specified during backup

before you can use that file to restore an Analysis Services database.

During restoration, you have the following options:

You can restore the database using the original database name, or you can specify a new

database name.

You can overwrite an existing database. If you choose to overwrite the database, you

must expressly specify that you want to overwrite the existing database.

You can choose whether to restore existing security information or skip security

membership information.

You can choose to have the restore command change the restoration folder for each

partition being restored. Local partitions can be restored to any folder location that is

local to the Analysis Services instance to which the database is being restored. Remote

partitions can be restored to any folder on any server, other than the local server; remote

partitions cannot become local.

Security Note

For each backup file, the user who runs the restore command must have permission to

read from the backup location specified for each file. To restore an Analysis Services

database that is not installed on the server, the user must also be a member of the server

role for that Analysis Services instance. To overwrite an Analysis Services database, the

user must have one of the following roles: a member of the server role for the Analysis

Services instance, or a member of a database role with Full Control (Administrator)

permissions on the database to be restored.

Note

After restoring an existing database, the user who restored the database might lose access

to the restored database. This loss of access can occur if, at the time that the backup was

performed, the user was not a member of the server role or was not a member of the

database role with Full Control (Administrator) permissions.

Page 4: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

3

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

IMPLEMENTION TO SHOW HOW ANALYSIS SERVICE DATABASE IS ATTACHED AND DETACHED

Detach Analysis Services Database in Command Mode

<Detach xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Object>

<DatabaseID>test2</DatabaseID>

</Object>

</Detach>

Detach Analysis Services Database in GUI Mode

Follow the following steps for detaching database in GUI mode right click on the database it will pop-up

a dialogue box there is option to detach as shown below click on the detach option to detach .

Page 5: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

4

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

Attach Analysis Services Database in Command Mode

<Attach xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Folder>E:\CROOKY_WORKS\Analysis_Services\test2.0.db\</Folder>

<ReadWriteMode

xmlns="http://schemas.microsoft.com/analysisservices/2008/engine/100">ReadWri

te</ReadWriteMode>

</Attach>

Attach Analysis Services Database in GUI Mode

1. Now to attach the database fist we have to set the browse option to browse for folder from

where we are going to attach database .Go to properties of the analysis services and click on it.

Page 6: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

5

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

2. Now click on the check box Show advanced option and at the first option in the properties pane

we will get AllowedBrowsingFolders click on that now append your path of the database which

you want to attach after putting | for e.g.

C:\Program_Files\Microsoft_SQL_Server\MSAS10_50.MSSQLSERVER\OLAP\Backup\|C:\Program

Files\Microsoft_SQL_Server\MSAS10_50.MSSQLSERVER\OLAP\Log

|E:\CROOKY_WORKS\Analysis_Services\test2.0.db

Page 7: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

6

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

3. Now go the database right click on the button and click on the attach button as shown

4. Here you can see that directory appears which we added previously in properties of analysis

services .Please note that it does not require restart of analysis service SQL server engine

Page 8: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

7

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

5. Now click on the ok button by selecting the directory where your database resides which will

make the folder available in the first dialogue box click OK to attach and you are done.

6. Click on the refresh button to show the database on the list of databases.

Page 9: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

8

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

Backing up Analysis Services Database in Command Mode

<Backup xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Object>

<DatabaseID>test2</DatabaseID>

</Object>

<File>E:\CROOKY_WORKS\Analysis_Services\test2.0.db\test2.abf</File>

<AllowOverwrite>true</AllowOverwrite>

<Password>paxcel@123</Password>

</Backup>

Backing up Analysis Services Database in GUI Mode

1. Right Click on the Analysis Service Database in dialogue box Backup as shown.

Page 10: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

9

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

2. You can change the location of the backup of analysis service database by click on the browse

button and directories which are available in browsing list ,there is option to overwrite the

existing backup on the same location you can also specify password to encrypt your backup

when you are done with the above mentioned scenario go ahead and click on OK button to

initiate the backup of analysis service database in GUI mode.

Page 11: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

10

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

Scheduling Backup of Analysis Services Database in Command Mode through SQL Server Agent

USE [msdb]

GO

/****** Object: Job [Analysis service_Backups] Script Date: 04/24/2013

23:52:27 ******/

BEGIN TRANSACTION

DECLARE @ReturnCode INT

SELECT @ReturnCode = 0

/****** Object: JobCategory [Database Maintenance] Script Date:

04/24/2013 23:52:27 ******/

IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'Database

Maintenance' AND category_class=1)

BEGIN

EXEC @ReturnCode = msdb.dbo.sp_add_category @class=N'JOB', @type=N'LOCAL',

@name=N'Database Maintenance'

IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback

END

DECLARE @jobId BINARY(16)

EXEC @ReturnCode = msdb.dbo.sp_add_job @job_name=N'Analysis

service_Backups',

@enabled=1,

@notify_level_eventlog=0,

@notify_level_email=0,

@notify_level_netsend=0,

@notify_level_page=0,

@delete_level=0,

@description=N'Analysis service_Backups',

@category_name=N'Database Maintenance',

@owner_login_name=N'AVINASH-PC\AVINASH', @job_id = @jobId OUTPUT

IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback

/****** Object: Step [SAAS_BACKUP] Script Date: 04/24/2013 23:52:28

******/

EXEC @ReturnCode = msdb.dbo.sp_add_jobstep @job_id=@jobId,

@step_name=N'SAAS_BACKUP',

@step_id=1,

@cmdexec_success_code=0,

@on_success_action=1,

@on_success_step_id=0,

@on_fail_action=2,

@on_fail_step_id=0,

@retry_attempts=0,

@retry_interval=0,

@os_run_priority=0, @subsystem=N'ANALYSISCOMMAND',

@command=N'<Backup

xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Object>

<DatabaseID>test2</DatabaseID>

</Object>

<File>E:\CROOKY_WORKS\Analysis_Services\test2.0.db\test2.abf</File>

<AllowOverwrite>true</AllowOverwrite>

<Password>paxcel@123</Password>

</Backup>

',

Page 12: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

11

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

@server=N'localhost',

@database_name=N'master',

@flags=0

IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback

EXEC @ReturnCode = msdb.dbo.sp_update_job @job_id = @jobId, @start_step_id =

1

IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback

EXEC @ReturnCode = msdb.dbo.sp_add_jobschedule @job_id=@jobId,

@name=N'saas_job',

@enabled=1,

@freq_type=4,

@freq_interval=1,

@freq_subday_type=1,

@freq_subday_interval=0,

@freq_relative_interval=0,

@freq_recurrence_factor=0,

@active_start_date=20130424,

@active_end_date=99991231,

@active_start_time=0,

@active_end_time=235959,

@schedule_uid=N'328e1b34-d23f-4bbb-89ca-3499d79e2512'

IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback

EXEC @ReturnCode = msdb.dbo.sp_add_jobserver @job_id = @jobId, @server_name =

N'(local)'

IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback

COMMIT TRANSACTION

GOTO EndSave

QuitWithRollback:

IF (@@TRANCOUNT > 0) ROLLBACK TRANSACTION

EndSave:

GO

Page 13: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

12

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

Scheduling Backup of Analysis Services Database in GUI Mode through SQL Server Agent

1. Connect To SQL Server Management Studio and then Browse to SQL Server Agent and right click

on the new job .

Page 14: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

13

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

2. A new job will appear in the pane and name it as Analysis Service_Backups define owner of the

job in this case here owner is AVINASH-PC\AVINASH .Choose category database maintenance

and describe your job in description text box and the browse to steps.

Page 15: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

14

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

3. Click on the new button in the steps.

Page 16: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

15

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

4. Name the step and in the type drop down select SQL Server Analysis Service Command and in

Run as select SQL Server Agent Service Account and in the Server textbox write your server

name and in the command text box enter the following command which will be run by the job

<Backup

xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Object>

<DatabaseID>test2</DatabaseID>

</Object>

<File>E:\CROOKY_WORKS\Analysis_Services\test2.0.db\test2.abf</File>

<AllowOverwrite>true</AllowOverwrite>

<Password>paxcel@123</Password>

</Backup>

And then click on ok button.

Page 17: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

16

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

5. Now schedule your job accordingly name the job schedule and scheduling type and its

frequency and time and click ok.

Page 18: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

17

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

6. Now at this point we are done refresh your job pane to check the new job which we have

added.

Restore Analysis Services Database in Command Mode

<Restore xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<File>C:\Program Files\Microsoft SQL

Server\MSAS10_50.MSSQLSERVER\OLAP\Backup\test2.abf</File>

<DatabaseName>test2</DatabaseName>

<AllowOverwrite>true</AllowOverwrite>

<Password>paxcel@123</Password>

<DbStorageLocation

xmlns="http://schemas.microsoft.com/analysisservices/2008/engine/100/100">E:\

CROOKY_WORKS\Analysis_Services\test2.0.db\</DbStorageLocation>

</Restore>

Page 19: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

18

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

Restore Analysis Services Database in GUI Mode

1. Right click on the database button and dialogue box will show restore option click on it.

2. Click on the browse option to browse the backup file .

Page 20: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

19

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

3. Select the path where we have taken backup and name backup file having extension .abf as

shown and click OK.

Page 21: Microsoft SQL Server Analysis Services · PDF fileAuthored by: AVINASH KUMAR SINGH COMPANY: PAXCEL TECHNOLOGIES PVT.LTD Microsoft SQL Server Analysis Services Analysis Services Data

20

Mic

roso

ft S

QL

Ser

ver

An

aly

sis

Ser

vic

es

4. In restore database write your database name and data directory path from the list of available

data directories available in browse section since we have deleted over database so we are

opting for Allow database overwrite option .There is option for overwrite security information u

can check it also but it is not mandatory select copy all option and the give the password at the

encryption part as shown which was given when to database was being backed .Then click on

OK button to complete the restore process.