Don't map network drives and expect them to be there. Just backup to the network path directly.
Using mapped drives gets tricky fast as you start to make assumptions that the drive letter will be available next time. What happens when you add another hard drive to the server later and want to use that drive letter? What happens when Windows disconnects the drive to reclaim the network socket?
Not the answer you're looking for? Browse other questions tagged sql-serversql-server-2008t-sqlssms or ask your own question.
I try to map my other DB to a user by going to Security > Logins > right click someuser > Properties > User Mapping > Select DB > set as db_owner and then ok, but I keep on getting an error saying
User, group, or role 'someuser' already exists in the current database. (Microsoft SQL Server, Error: 15023)
What is causing the error, and how do I map that user to the database?
To fix the user and login mapping you need to open a query window in the SQL Server Management Studio. Enter the following two lines and replace myDB with the database name and myUser with the correct user name:
If run successfully you should get an output like this one:
Your user should now be mapped correctly.
Edit:
User Mapping Sql Server
New way to Resolve/Fix an Orphaned User:
In the master database, use the CREATE LOGIN statement with the SID option to recreate a missing login, providing the SID of the database user.
To map an orphaned user to a login which already exists in master, execute the ALTER USER statement in the user database, specifying the login name.
When you recreate a missing login, the user can access the database using the password provided. Then the user can alter the password of the login account by using the ALTER LOGIN statement.
CR241CR241
If you assign permissions to a database user without mapping it to the database first, it throws the error you mentioned.
You should be able to delete the user, map it to the database and then assign the user to the db_owner role.
knockoutknockout
if it is just one or two users, then easiest way is to drop the database user from the restored database, remap the database user to the server login using SSMS. If the server login does not exist then just create it, map the user.
Option 2: If you are migrating a large number of users, use sp_help_revlogin. sp_help_revlogin is a Microsoft supplied stored procedure that will help migrate logins from one server to another, including passwords and SIDs. Here is a good article about it SP_HELP_REVLOGIN : http://www.databasejournal.com/features/mssql/article.php/2228611/Migrating-Logins-from-One-SQL-Server-to-Another.htm
Code patches to help use it : run following T-SQL Query in Query Analyzer. This will return all the existing users in database in result pan.
Eeupdate intel mac command line. . If you run EEUPDATE without any command line options, EEUPDATE will display a listing of all of the supported Intel Network adapters found in your system. When using the '/dump' command, EEUPDATE will automatically create a file and name it, based on the last 8 bytes of your Intel Network adapter's MAC Address.
Run following T-SQL Query in Query Analyzer to associate login with the username. ‘Auto_Fix’ attribute will create the user in SQL Server instance if it does not exist. In following example ‘ColdFusion’ is UserName, ‘cf’ is Password. Auto-Fix links a user entry in the sysusers table in the current database to a login of the same name in sysxlogins.
Run following T-SQL Query in Query Analyzer to associate login with the username. ‘Update_One’ links the specified user in the current database to login. login must already exist. user and login must be specified. password must be NULL or not specified
2) If login account has permission to drop other users, run following T-SQL in Query Analyzer. This will drop the user.
Create the same user again in the database without any error.
Not the answer you're looking for? Browse other questions tagged sqlsql-server or ask your own question.
Launch SQL Server Management Studio and connect with credentials that have been granted the 'sa' role.
Expand *Security*, right-click on *Logins* and select *New Login*.
Enter a descriptive *Login name*, select *SQL Server authentication*, and enter a secure password. On the bottom of the page select the database Chartio will be connecting to as the *Default database*.
Select the *User Mapping* tab, check the box next to the desired database, confirm that only 'public' is selected, and click *OK*.
Click the *New Query* button and select the database you are connecting to Chartio.
Paste the following query into the query window and execute. Replace 'chartio_read_only' with the actual username of the user you created.
Select and copy the query results into the query window.
Remove any tables or views you do not wish the 'chartio_read_only user' to have access to. In this example I have removed the Invoice and InvoiceLine tables because they contain sensitive information.
Execute the query.
You can now use these credentials to connect Chartio to your database with read-only permissions on only the tables you have specified.