About Me

My photo
I am MCSE in Data Management and Analytics with specialization in MS SQL Server and MCP in Azure. I have over 13+ years of experience in IT industry with expertise in data management, Azure Cloud, Data-Canter Migration, Infrastructure Architecture planning and Virtualization and automation. Contact me if you are looking for any sort of guidance in getting your Infrastructure provisioning automated through Terraform. I sometime write for a place to store my own experiences for future search and read by own blog but can hopefully help others along the way. Thanks.

Process to Backup- restore or move the SSIS catalog from one server to another

After normal restore of SSISDB database from one server to another server user started getting below error like

Please create a master key in the database or open the master key in the session before performing this operation.




In order to resolve this issue:
Follow steps specified in this blog.


Thanks for Reading. 

updating permission setting for file 'F:\INST21_DAta\System Volumne Information\ResumeKeyFilter.store failed. The file permission settings were supposed to be set to D:P(A;OICI;FA;;;BA)(A;OICI;FA;;;SY)(A;OICI;FA;;;S-1-5-80-1237161748-11049725-35363445448-169532831-1350696550)'

Issue:-
Permission error occurs when you use a volume mount point in SQL Server Setup
Problem:-

When you install  SQL Server 2016 RTM/2014 RTM/2012 RTM on Windows Server 2012 R2, the Installation fails in Cluster when you assign a SQL Server system folder (such the data or LOG file location) to a volume mount point root folder and you receive the following error message:-

The Following error has occurred:-
updating permission setting for file 'F:\INST21_DAta\System Volumne Information\ResumeKeyFilter.store failed. The file permission settings were supposed to be set to D:P(A;OICI;FA;;;BA)(A;OICI;FA;;;SY)(A;OICI;FA;;;S-1-5-80-1237161748-11049725-35363445448-169532831-1350696550)' 






























As far as using Mount Points with SQL Server is concerned below are recommended 


The key points for mount points in combination with SQL Server 2005, 2008, 2008 R2 and above are:
  • A valid mount point that can be used by SQL Server databases is one that is mounted to a host volume (a shared drive in a cluster) that is associated with a drive letter. Multiple mount points can be hosted by a single drive meaning multiple mount points share a drive letter.
  • In a cluster, SQL Server must depend on each mount point it uses to avoid database corruption.
  • Do not install SQL Server to the root directory of a mount point, always specify a subdirectory for all files. This has to do with how permissions are granted. If you must put files in the root of the mount point you must manually manage the ACLs/permissions.
  • Do not put DTC on a mount point.
  • we should not use Cluster Disk X and Cluster Disk Y on the same drive letter. This will  lead to fatal error. 
For various reasons such as standardization, flexibility, space management, and just not enough letters in the alphabet many people use mount points on their servers. A mount point (aka mounted drive or volume junction) is a separate file system that is “mounted” onto a host drive so that it appears to be a subdirectory of the host drive. For example, say you have LUN volume A that is made visible to Windows as drive X:. You have a LUN volume B from another storage array and you want to present it to Windows. You might choose to mount it as X:\SQL1. To SQL it looks like a sub-directory, but it’s really a whole different file system. Because it is a different file system, permissions are not inherited from the host system. So when you grant permissions to X: and say to propagate them to child folders, they are NOT applied to the mount point!

Hence in order to resolve this issue:-
To resolve this problem, create a subfolder in the volume mount point, and assign the new subfolder to the SQL Server system folders.

After creating sub folder on the volume mount point, the issue resolved. 

Thanks for Reading.. 





Modifiers in mogoDB $inc $set $unset

                               How to use $inc $set $unset as a Modifiers in MongoDB
------------------------------------------------------------------------------------------------------------

usually certain portion of documents needs to be updated.
You can update specific fields in a document using atomic update modifies.
update modifiers are special keys that can be used to specify complex update operations, such as
  1. altering
  2.adding
  3.removing keys
  4. Manipulating arrays.
  5. Manipulating arrays on embedded documents

$inc:-
--------
Suppose we were keeping website analytics in a collection and wanted to increment a
counter each time someone visited a page.
We can use update modifiers to do this increment atomically. Each URL and its number of page views is stored in a document
that looks like this:

{
"_id" : ObjectId("4b253b067525f35f94b60a31"),
"url" : "www.example.com",
"pageviews" : 52
}

Every time someone visits a page, we can find the page by its URL and use the "$inc"
modifier to increment the value of the "pageviews" key:

> db.analytics.update({"url" : "www.example.com"},
... {"$inc" : {"pageviews" : 1}})
Now, if we do a find, we see that "pageviews" has increased by one:

> db.analytics.find()
{
"_id" : ObjectId("4b253b067525f35f94b60a31"),
"url" : "www.example.com",
"pageviews" : 53
}

When using modifiers, the value of "_id" cannot be changed. (Note that "_id" can be
changed by using whole-document replacement.) Values for any other key, including
other uniquely indexed keys, can be modified.

Getting started with the “$set” modifier

"$set" sets the value of a field. If the field does not yet exist, it will be created. This can
be handy for updating schema or adding user-defined keys. For example, suppose you
have a simple user profile stored as a document that looks something like the following:
> db.users.findOne()
{
"_id" : ObjectId("4b253b067525f35f94b60a31"),
"name" : "joe",
"age" : 30,
"sex" : "male",
"location" : "Wisconsin"
}

This is a pretty bare-bones user profile. If the user wanted to store his favorite book in
his profile, he could add it using "$set":

> db.users.update({"_id" : ObjectId("4b253b067525f35f94b60a31")},
... {"$set" : {"favorite book" : "War and Peace"}})

Now the document will have a “favorite book” key:

> db.users.findOne()
{
"_id" : ObjectId("4b253b067525f35f94b60a31"),
"name" : "joe",
"age" : 30,
"sex" : "male",
"location" : "Wisconsin",
"favorite book" : "War and Peace"
}

If the user decides that he actually enjoys a different book, "$set" can be used again to
change the value:

> db.users.update({"name" : "joe"},
... {"$set" : {"favorite book" : "Green Eggs and Ham"}})

"$set" can even change the type of the key it modifies. For instance, if our fickle user
decides that he actually likes quite a few books, he can change the value of the “favorite
book” key into an array:

> db.users.update({"name" : "joe"},
... {"$set" : {"favorite book" :
... ["Cat's Cradle", "Foundation Trilogy", "Ender's Game"]}})

$unset

If the user realizes that he actually doesn’t like reading, he can remove the key altogether
with "$unset":

> db.users.update({"name" : "joe"},
... {"$unset" : {"favorite book" : 1}})

Now the document will be the same as it was at the beginning of this example.

 We can also use $set modifiers to reach in and change embedded documents:

You can also use "$set" to
> db.blog.posts.findOne()
{
"_id" : ObjectId("4b253b067525f35f94b60a31"),
"title" : "A Blog Post",
"content" : "...",
"author" : {
            "name" : "joe",
            "email" : "joe@example.com"
                 }
}
> db.blog.posts.update({"author.name" : "joe"},
... {"$set" : {"author.name" : "joe schmoe"}})

> db.blog.posts.findOne()
{
"_id" : ObjectId("4b253b067525f35f94b60a31"),
"title" : "A Blog Post",
"content" : "...",
"author" :
      {
          "name" : "joe schmoe",
          "email" : "joe@example.com"
       }
}

Thanks for reading..



How to CRUD (Create,Read,Update and Delete) & create an embedded document and Alter a key in embedded doument in mongoDB

/*Create a User Database Named PersonDB */

MongoDB Enterprise > use personDB
switched to db personDB

/*Check you are in which database */
MongoDB Enterprise > db
personDB

/*Create a Post Variable */
MongoDB Enterprise > post={"name":"Rakesh","friend":477,"enemy":2}

{ "name" : "Rakesh", "friend" : 477, "enemy" : 2 }
/* Create Person table and Insert data into that table using  post variable*/

MongoDB Enterprise > db.Person.insert(post)
WriteResult({ "nInserted" : 1 })
MongoDB Enterprise > db.person.read()

MongoDB Enterprise > db.person.find()
-- Value did not return because MongoDB is highly case sensitive

/* search record inserted or not */
MongoDB Enterprise > db.Person.find()
{ "_id" : ObjectId("5896e738afd337d2cb8debce"), "name" : "Rakesh", "friend" : 477, "enemy" : 2 }

/* Now we need to add Address column as a embedded document using post variable */

-- The First step is to modify the variable post and add a "comment" key:

MongoDB Enterprise > post.address={"street":"L B S Nagar","House No":203,"Apartment":"Cansa Park"}

MongoDB Enterprise > db.Person.update({"name":"Rakesh"},post)
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
MongoDB Enterprise > db.Person.find()
{ "_id" : ObjectId("5896e738afd337d2cb8debce"), "name" : "Rakesh", "friend" : 477, "enemy" : 2, "address" : { "street" : "L B S XXXX", "House No" : 1234, "Apartment" : "Salnsa XXX" } }

MongoDB Enterprise > db.Person.findone()
2017-02-05T14:44:09.204+0530 E QUERY    [thread1] TypeError: db.Person.findone is not a function :
@(shell):1:1

MongoDB Enterprise > db.Person.findOne()
{
        "_id" : ObjectId("5896e738afd337d2cb8debce"),
        "name" : "Rakesh",
        "friend" : 477,
        "enemy" : 2,
        "address" : {
                "street" : "L B S XXXX",
                "House No" : 1234,
                "Apartment" : "Salnsa XXX"
        }
}


/* Now we have to add a key Pin in address to Address key */

MongoDB Enterprise > post.address={"street":"L B S XXXX","House No":1234,"Apartment":"Salnsa XXX","pin":560017}

{
        "street" : "L B S XXXX",
        "House No" : 1234,
        "Apartment" : "Salnsa XXX",
        "pin" : 560017
}

MongoDB Enterprise > db.Person.update({"name":"Rakesh"},post)

WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })

MongoDB Enterprise > db.Person.findOne()
{
        "_id" : ObjectId("5896e738afd337d2cb8debce"),
        "name" : "Rakesh",
        "friend" : 477,
        "enemy" : 2,
        "address" : {
                "street" : "L B S XXXX",
                "House No" : 1234,
                "Apartment" : "Salnsa XXX",
                "pin" : 560017
        }
}
Removing  Documents
Now that there is a data on our database, let's delete it:
MongoDB Enterprise >
MongoDB Enterprise > db.Person.remove()

2017-02-05T15:36:30.004+0530 E QUERY    [thread1] Error: remove needs a query :
DBCollection.prototype._parseRemove@src/mongo/shell/collection.js:409:1
DBCollection.prototype.remove@src/mongo/shell/collection.js:434:18
@(shell):1:1

MongoDB Enterprise > db.Person.remove({"name":"Rakesh"})

WriteResult({ "nRemoved" : 1 })

--This does not actually remove the collections, and any meta information about it will still exist.

MongoDB Enterprise > show collections;
Person
MongoDB Enterprise >