ADS

Featured

How to create a SQL Server database as it is created in UOL or Locaweb?

When we create a database on the SQL server, when we install SQL Server express, we always see all the databases we create, even if a specific user is created to access it.

However, if you hire a SQL Server database on a shared plan such as Locaweb, UOL Host, among others, you may notice that you will see only the database that you have hired and will not see any other database, no really?

With the script below that I am going to teach you, you will create an equal database, and even resell it with more quality to your customers, if you are a service provider, without showing that pile of databases from other customers.


As much as you do not have permission, it is ugly to view multiple databases of all clients on a single server (as is the case with mochahost).


Here is the code to create a user without viewing the databases that do not belong to him:
use master;
create databaase novo_cliente;
create login novo_cliente_user with password 'senha-do-cliente';
deny view any database to novo_cliente_user;
And now, no base is viewed by the user. So, he needs to be an owner to view the base.
I always have the habit of doing this:
use novo_cliente
exec sp_changedbowner novo_cliente_user
And there, security established, we can now provide the login for the external, remote client, or even internal client, as a development environment, without having to view all the bases on the server.

No comments