The example takes a SQL Server 2012 database. System Windows 2008R2 SP1.
First, enable Filesstream
Open the SQL Server 2012 Configuration tool, open SQL Server Configuration Manager, select SQL Server service, locate SQL Server (Mssqlsrever), right-click Properties, and locate the Filesstream column Operation
1. Enable the FileStream attribute of the database through SQL Server Configuration Manager. Then, set the accessibility level of the Fielstream by using the following statement:
?
12 |
EXEC sp_configure filestream_access_level, 2 RECONFIGURE |
Ii. Adding a master key for SharePoint content databases
?
1234 |
use [WSS_Content]
if
not
exists (
select
*
from
sys.symmetric_keys
where
name
=
N
‘##MS_DatabaseMasterKey##‘
)
create
master
key encryption
by
password
=
N
‘输入密码‘
|
Iii. adding FileStream filegroups and files to the content database
?
1234567 |
use [WSS_Content]
if
not
exists (
select
groupname
from
sysfilegroups
where
groupname=N
‘RBSFilestreamProvider‘
)
alter
database
[WSS_Content]
add
filegroup RBSFilestreamProvider
contains
filestream
use [WSS_Content]
alter
database [WSS_Content]
add
file (
name
= RBSFilestreamFile,
filename =
‘c:\blobstore‘
)
to
filegroup RBSFilestreamProvider
|
Iv. installation of RBS
1, can be directly executed Rbs_x64.msi file to install the program, the official download SQL Server2013 Rbs.msi
Check if the installation was successful by using the following statement
SELECT * from dbo.sysobjects where name like ' rbs% '
Five enable RBS
$CDB = get-spcontentdatabase "WSS_Content"
$RBSS = $cdb. Remoteblobstoragesettings
$rbss. Installed ()
$rbss. Enable ()
$pvdName = $rbss. Getprovidernames () [0]
$rbss. Setactiveprovidername ($pvdName)
$rbss. Migrate ()//This command can migrate blobs in the SharePoint content database to the file system
$rbss. Minimumblobstoragesize = 1048000//The command is used to set the minimum file value that is stored in the file system and is saved in the database as usual when the file is smaller than the value.
$cdb. Update ()
Vi. garbage collection mechanism
This article has been very well said, you can click to read
I emphasize several points:
Usually we delete the document, not really deleted, but saved in the SharePoint Recycle Bin, the Recycle Bin has two layers, the first layer is the user operation, can be deleted or restored, and the PC computer, the second layer is the site collection Recycle Bin, generally need to be an administrator to operate, after this layer is deleted, The file cannot be restored through SharePoint.
Garbage collection is a slow process that can be judged by the size of the folder in which files are stored at intervals.
Vii. Uninstalling RMS
1. Uninstall in SharePoint
$CDB =get-spcontentdatabase <ContentDbName>
$rbs = $cdb. Remoteblobstoragesettings
$rbs. Getprovidernames ()
$rbs. Setactiveprovidername ("")
$rbs. Migrate ()
$rbs. Disable ()
2. Run cmd in administrator mode, start recycle
C:\Program Files\Microsoft SQL Remote Blob Storage 11.0\maintainer\microsoft.data.sqlremoteblobs.maintainer.exe "- connectionStringName rbsmaintainerconnection-operation garbagecollection ConsistencyCheck Consistencycheckforstores-garbagecollectionphases Rdo-consistencycheckmode R-timelimit 120
3. Click Rbs.msi Install file to uninstall RBS
4. Delete the RBS in the database
EXEC mssqlrbs.rbs_sp_uninstall_rbs 0
ALTER TABLE [mssqlrbs_filestream_data_1]. [Rbs_filestream_configuration] DROP column [Filestream_value]
ALTER TABLE [mssqlrbs_filestream_data_1]. [Rbs_filestream_configuration] SET (filestream_on = "NULL")
Now you can delete files and file stream filegroup:
ALTER DATABASE yourdbname Remove file rbsfilestreamfile;
ALTER DATABASE yourdbname REMOVE FILEGROUP rbsfilestreamprovider;
SharePoint RBS (Remote BLOB storag) installation, deployment, garbage collection