Advertisement
hoscanoa

SegundoIntento

Mar 4th, 2014
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 2.05 KB | None | 0 0
  1. CREATE DATABASE BDARCOR
  2. ON PRIMARY
  3. (
  4.     NAME=ARCORDATA,
  5.     FILENAME='C:\ARCOR\SRVLIMA\DATA\ARCORDATA.NDF',
  6.     SIZE=5MB,
  7.     MAXSIZE=50MB,
  8.     FILEGROWTH=10%
  9. ),
  10. FILEGROUP[FGLOGISTICA]
  11. (
  12.     NAME=ARCORDATA2,
  13.     FILENAME='C:\ARCOR\SRVICA\DATA\ARCORDATA2.NDF',
  14.     SIZE=5MB,
  15.     MAXSIZE=50MB,
  16.     FILEGROWTH=10%
  17. ),
  18. FILEGROUP[FGVENTAS]
  19. (
  20.     NAME=ARCORDATA3,
  21.     FILENAME='C:\ARCOR\SRVTUMBES\DATA\ARCORDATA3.NDF',
  22.     SIZE=5MB,
  23.     MAXSIZE=50MB,
  24.     FILEGROWTH=10%
  25. )
  26. LOG ON
  27. (
  28.     NAME=ARCORLOG,
  29.     FILENAME='C:\ARCOR\SRVLIMA\DATA\ARCORLOG.LDF',
  30.     SIZE=5MB,
  31.     MAXSIZE=50MB,
  32.     FILEGROWTH=10%
  33. )
  34. GO
  35.  
  36. ----
  37. USE BDARCOR
  38. SELECT * FROM SYS.filegroups
  39. GO
  40.  
  41.  
  42.  
  43. ---Modificar la BD para agregar un datafile a un determinado filegroup
  44.  
  45. ALTER DATABASE BDARCOR
  46. ADD FILE
  47. (
  48.     NAME=ARCORDATA22,
  49.     FILENAME='C:\ARCOR\SRVICA\DATA\ARCORDATA22.NDF',
  50.     SIZE=5MB,
  51.     MAXSIZE=50MB,
  52.     FILEGROWTH=10%
  53. )
  54. TO FILEGROUP [FGLOGISTICA]
  55. GO
  56.  
  57. -------------------------------------------------------
  58.  
  59. ALTER DATABASE BDARCOR
  60. ADD FILE
  61. (
  62.     NAME=ARCORDATA33,
  63.     FILENAME='C:\ARCOR\SRVTUMBES\DATA\ARCORDATA33.NDF',
  64.     SIZE=5MB,
  65.     MAXSIZE=50MB,
  66.     FILEGROWTH=10%
  67. ),
  68. (
  69.     NAME=ARCORDATA333,
  70.     FILENAME='C:\ARCOR\SRVTUMBES\DATA\ARCORDATA333.NDF',
  71.     SIZE=5MB,
  72.     MAXSIZE=50MB,
  73.     FILEGROWTH=10%
  74. )
  75. TO FILEGROUP [FGVENTAS]
  76. GO
  77.  
  78. -------------------------------------------------------
  79.  
  80. --MODIFICAR LA BASE DE DATOS PARA CREAR UN FILEGROUP
  81. ALTER DATABASE BDARCOR
  82. ADD FILEGROUP [FGPRODUCCION]
  83. GO
  84.  
  85. --MODIFICAR LA BASE DE DATOS PARA AGREGAR UN DATAFILE AL NUEVO FILEGROUP
  86.  
  87. ALTER DATABASE BDARCOR
  88. ADD FILE
  89. (
  90.     NAME=ARCORDATA4,
  91.     FILENAME='C:\ARCOR\SRVLIMA\DATA\ARCORDATA4.NDF',
  92.     SIZE=5MB,
  93.     MAXSIZE=50MB,
  94.     FILEGROWTH=10%
  95. )
  96. TO FILEGROUP[FGPRODUCCION]
  97. GO
  98.  
  99.  
  100. --MODIFICAR LA BD PARA ELIMINAR UN DATAFILE
  101. --OJO QUE ESTO SOLO FUNCIONA SI NO CONTIENE DATOS (ESTA VACIO), SINO HABRA ERRORES
  102. ALTER DATABASE BDARCOR
  103. REMOVE FILE ARCORDATA333
  104. GO
  105.  
  106.  
  107. --MODIFICAR LA BD PARA CAMBIAR LA UBICACION DE UN DATAFILE
  108. --DE ICA A LIMA
  109.  
  110. ALTER DATABASE BDARCOR
  111. MODIFY FILE
  112. (
  113.     NAME=ARCORDATA2,
  114.     FILENAME='C:\ARCOR\SRVLIMA\DATA\ARCORDATA2.NDF'
  115. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement