notebook/IT/SQL/SCRIPTS SQL QSA ORSYS/Demo partitionnement gestion.sql

33 lines
822 B
MySQL
Raw Normal View History

2020-11-26 17:38:25 +00:00
USE [DB_GRAND_HOTEL];
GO
-- rajouter une partition :
-- 1) cr<63>er le stockage
ALTER DATABASE [DB_GRAND_HOTEL]
ADD FILEGROUP FG_PART_2009;
ALTER DATABASE [DB_GRAND_HOTEL]
ADD FILE (NAME = 'F_PART_2009',
FILENAME = 'H:\DATABASE_SQL\SQL2019FBIN2\DATA\HOTEL_PART_2009.ndf',
SIZE = 25,
FILEGROWTH = 10)
TO FILEGROUP FG_PART_2009;
-- 2) modifier le schema de paritionnement
ALTER PARTITION SCHEME PS_DATE_FACTURE
NEXT USED FG_PART_2009;
GO
-- 3) ajouter le "piquet" de partitionnement
ALTER PARTITION FUNCTION PF_DATE_FACTURE()
SPLIT RANGE ('2009-01-01');
-- autres possibilit<69>s
-- XXX) r<>aranger les partitions => ALTER PARTITION FUNCTION ... MERGE
-- XXX) supprimer les donn<6E>es de certainers partitions => TRUNCATE PARTITION