[SQL Server] Déplacement de fichiers Data
sp_helpfile
---debut 1
alter database MEKTABA set offline
go
--Ou rajouter l'option WITH ROLLBACK IMMEDIATE qui permet de mettre la BD hors ligne immédiatement
--L'option WITH ROLLBACK IMMEDIATE annule toutes les transactions en cours
-- !!!! Cette commande ne peux être lancée que lorsque on a décider de restaurer la BD !!!
-- !!! Penser à lancer cette commande aprés lancement d'un Checkpoint qui valide les transactions en cours !!!
alter database MEKTABA set offline WITH ROLLBACK IMMEDIATE
go
---fin 1
---debut 2
---Début Déplacement des Indexes
alter database MEKTABA
modify file (name = FI_MEKTABA_DIM,filename="U:\INDEX\MEKTABA\FI_MEKTABA_DIM.ndf")
go
alter database MEKTABA
modify file (name = FI_MEKTABA_OLTP_IX01,filename="U:\INDEX\MEKTABA\FI_MEKTABA_OLTP_IX01.ndf")
go
alter database MEKTABA
modify file (name = FI_MEKTABA_OLTP_IX02,filename="U:\INDEX\MEKTABA\FI_MEKTABA_OLTP_IX02.ndf")
go
alter database MEKTABA
modify file (name = FI_MEKTABA_OLTP_IX03,filename="U:\INDEX\MEKTABA\FI_MEKTABA_OLTP_IX03.ndf")
go
alter database MEKTABA
modify file (name = FI_MEKTABA_OLTP_IX04,filename="U:\INDEX\MEKTABA\FI_MEKTABA_OLTP_IX04.ndf")
go
alter database MEKTABA
modify file (name = FI_MEKTABA_OLTP_PK01,filename="U:\INDEX\MEKTABA\FI_MEKTABA_OLTP_PK01.ndf")
go
alter database MEKTABA
modify file (name = FI_MEKTABA_OLTP_PK02,filename="U:\INDEX\MEKTABA\FI_MEKTABA_OLTP_PK02.ndf")
go
alter database MEKTABA
modify file (name = FI_MEKTABA_OLTP_PK03,filename="U:\INDEX\MEKTABA\FI_MEKTABA_OLTP_PK03.ndf")
go
alter database MEKTABA
modify file (name = FI_MEKTABA_OLTP_PK04,filename="U:\INDEX\MEKTABA\FI_MEKTABA_OLTP_PK04.ndf")
go
-------------------------------a voir -------------------------------------------------
alter database MEKTABA
modify file (name = FD_MEKTABA_Primary,filename="P:\MEKTABA\DATA\PRIM\FD_MEKTABA_Primary.mdf")
go
--- déplacer c fichier aparès mettre dispo espace disque sur J
alter database MEKTABA
modify file (name = FD_MEKTABA_Primary_01,filename="P:\MEKTABA\DATA\PRIM\FD_MEKTABA_Primary_01.ndf")
go
-------------------------- a voir -----------------------------------------------------
---Fin Déplacement des Indexes
-- Début Déplacement Fichiers Data
--- Janvier
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_01_01,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_01_01.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_01_02,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_01_02.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_01_03,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_01_03.ndf")
go
--- Mars
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_03_01,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_03_01.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_03_02,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_03_02.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_03_03,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_03_03.ndf")
go
--- Mai
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_05_01,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_05_01.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_05_02,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_05_02.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_05_03,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_05_03.ndf")
go
--- Juillet
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_07_01,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_07_01.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_07_02,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_07_02.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_07_03,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_07_03.ndf")
go
--- Septembre
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_09_01,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_09_01.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_09_02,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_09_02.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_09_03,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_09_03.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_09_04,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_09_04.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_09_05,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_09_05.ndf")
go
--- Novembre
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_11_01,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_11_01.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_11_02,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_11_02.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_11_03,filename="U:\DATA\MEKTABA\FD_MEKTABA_OLTP_11_03.ndf")
go
-- Remettre ces fichiers dans l'endroit ou ils doivent exister
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_08_04,filename="P:\MEKTABA\DATA\OLTP\FD_MEKTABA_OLTP_08_04.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_OLTP_10_04,filename="P:\MEKTABA\DATA\OLTP\FD_MEKTABA_OLTP_10_04.ndf")
go
alter database MEKTABA
modify file (name = FD_MEKTABA_SAS_01,filename="P:\MEKTABA\DATA\SAS\FD_MEKTABA_SAS_01.ndf")
go
-- Fin Déplacement Fichiers Data
---fin 2
---debut 3
alter database MEKTABA
set online
go
---fin 3