15023: User already exists in the current database
SQL ServerNe demek?
Veritabanına yeni bir kullanıcı eklerken, aynı ada sahip bir kullanıcının o veritabanında zaten var olduğu belirlendi. Ayrıca bir login'i mevcut bir kullanıcıya bağlarken de görülür (orphaned users).
Neden olur?
Genellikle bir veritabanı yedekten farklı bir sunucuya geri yüklendiğinde login SID'leri ile veritabanı kullanıcıları eşleşmez (orphaned users). CREATE USER ile aynı adı yeniden eklemeye çalışmak ya da login-kullanıcı eşlemesini elle kurmaya çalışmak bu hatayı verir.
Nasıl çözülür?
Orphan user'ı mevcut login'e yeniden eşleyin: ALTER USER kullanici WITH LOGIN = login_adi; (eski yöntem sp_change_users_login yerine önerilir). Kullanıcı gerçekten fazlaysa: DROP USER kullanici; Orphan user'ları bulmak için: SELECT dp.name FROM sys.database_principals dp LEFT JOIN sys.server_principals sp ON dp.sid = sp.sid WHERE sp.sid IS NULL AND dp.type IN ('S','U');
Aynı motorda diğer kayıtlar
- 8114Error converting data type X to Y
- 1204The instance of the SQL Server Database Engine cannot obtain a LOCK resource
- 3906Failed to update database because the database is read-only
- 18452Login failed. The login is from an untrusted domain and cannot be used with Windows authentication
- 605Attempt to fetch logical page belongs to a different allocation unit
- 4922ALTER TABLE ALTER COLUMN failed because one or more objects access this column
- 7202Could not find server 'name' in sys.servers