Fetstil Fetstil Kursiv Understrykning linje färgläggning tabellverk Punktlista Nummerlista Vänster Centrerat högerställt Utfyllt Länk Bild htmlmode
  • Forum & Blog
    • Forum - översikt
      • .Net
        • asp.net generellt
        • c#
        • vb.net
        • f#
        • silverlight
        • microsoft surface
        • visual studio .net
      • databaser
        • sql-server
        • databaser
        • access
        • mysql
      • mjukvara klient
        • datorer och komponenter
        • nätverk, lan/wan
        • operativsystem
        • programvaror
        • säkerhet, inställningar
        • windows server
        • allmänt
        • crystal reports
        • exchange/outlook
        • microsoft office
      • mjukvara server
        • active directory
        • biztalk
        • exchange
        • linux
        • sharepoint
        • webbservers
        • sql server
      • appar (win/mobil)
      • programspråk
        • c++
        • delphi
        • java
        • quick basic
        • visual basic
      • scripting
        • asp 3.0
        • flash actionscript
        • html css
        • javascript
        • php
        • regular expresssion
        • xml
      • spel och grafik
        • DirectX
        • Spel och grafik
      • ledning
        • Arkitektur
        • Systemutveckling
        • krav och test
        • projektledning
        • ledningsfrågor
      • vb-sektioner
        • activeX
        • windows api
        • elektronik
        • internet
        • komponenter
        • nätverk
        • operativsystem
      • övriga forum
        • arbete karriär
        • erbjuda uppdrag och tjänster
        • juridiska frågor
        • köp och sälj
        • matematik och fysik
        • intern information
        • skrivklåda
        • webb-operatörer
    • Posta inlägg i forumet
    • Chatta med andra
  • Konto
    • Medlemssida
    • Byta lösenord
    • Bli bonsumedlem
    • iMail
  • Material
    • Tips & tricks
    • Artiklar
    • Programarkiv
  • JOBB
  • Student
    • Studentlicenser
  • KONTAKT
    • Om pellesoft
    • Grundare
    • Kontakta oss
    • Annonsering
    • Partners
    • Felanmälan
  • Logga in

Hem / Forum översikt / inlägg

Posta nytt inlägg


Återställa en backup utan användarkonton

Postades av 2007-02-06 15:34:01 - Hendrik Olsson, i forum sql-server/msde, Tråden har 1 Kommentarer och lästs av 1249 personer

Flyttar min fråga hit istället för i windows SQL server vet inte vad det forumet är bra för.

Återställa en backup utan användarkonton
2007-02-04 13:20:02 - Hendrik Olsson


Hej,

SQLexpress

Går det att återställa en databas utan att ta med användarkonton då dessa som blir skapade inte går att ta bort eller? så får jag fel då jag använde olika lösenord men samma kontonamn.

//Hendrik

Sv: Återställa en backup utan användarkonton
2007-02-04 22:22:10 - Hendrik Olsson

Genom att läsa min fråga en gång till så löste sig en del.

På de konton som jag ska ha kvar kan man byta lösenord så att det är samma som i backupen innan man kör restore på databasen, men nya konton som skapas i databasen går dessa att ta bort?

//Henke


Svara

Sv: Återställa en backup utan användarkonton

Postades av 2007-05-25 09:48:48 - Hendrik Olsson

Enligt denna längk education.sqlfarms.com/education/ShowPost.aspx?PostID=80 så ska det gå med script

This script synchronizes the SID (server ID) for all (both SQL and NT authentication) users on the current DB that their SID on sysusers does not match the SID on the master..syslogins table. All user permissions, privileges, role membership, and object ownerships are not impacted and are maintained, for all synched users. SID mismatch is a common occurrence after restoring a database on another (i.e., not the original) server. When the SID do not match, users cannot log onto the database properly, and security breaches can occur when logins and users are not synchroized.


The script uses the following algorithm, in order to synchronize users:

1. All users that require synchronization are first selected. These users are: (i) All SQL authenticated users that their SID does not appear on master..syslogins, and that their user name and login names are the same (a common practice in most SQL environments); and (ii) All NT authentication users that their SID are not in master..syslogins, and that their user name is in master..syslogins, or that there exists a login name <Domain>\<User> where <User> is the NT user name in sysusers on the current DB (the latter happens often, since SQL server GUIs omit the <Domain> from the user names on occasion).

2. For all other users that their SID in sysusers is not found on master..syslogins, the script user can set the parameter @DropUserIfUserNameAndSIDDoNotMatch to 1, so all such users will be dropped from the database if they do not own any DB objects. If @DropUserIfUserNameAndSIDDoNotMatch = 1 and such users indeed own objects, the script returns a list of all such users that cannot be dropped. If you do not wish to remove these users from the DB, simply leave the value of @DropUserIfUserNameAndSIDDoNotMatch = 0 (default value).

3. Performing the synchronization: For each synched user, the script first collects all user role memberships and permissions, by running sp_helprotect. Then, if the user owns any DB objects then one of two things is done: If the script is run on SQL 2000 SP3 or above, the script uses the proc sp_changeobjectowner to transfer object ownership to dbo (all ownerships are later given back to the synched user). If the server is of an earlier version, then the user is marked as one that cannot be synchronized, and the script returns a list of all such users upon its completion (it is possible to run sp_configure and change the object ownership of all user owned objects by updating the sysobjects table, however this can be very dangerous, and therefore it is not done here).

4. The script revokes DB access from all synched users, by using sp_revokedbaccess, and then re-grants DB access with sp_grantdbaccess. Then, all roles and permissions are restored for the user, and the ownership of its previous objects is assigned back to the user.

If any permissions are found to be suspect, or if any users cannot be synched due to the reasons listed above, the script returns a recordset of all such users and suspect permissions.



Svara

Nyligen

  • 14:24 CBD regelbundet?
  • 14:23 CBD regelbundet?
  • 14:22 Har du märkt några verkliga fördel
  • 09:09 Vill du köpa medicinska tester?
  • 12:47 Vem beviljar assistansen – kommune
  • 14:17 Någon med erfarenhet av hemstädnin
  • 14:14 Bör man använda sig av en båtförme
  • 14:12 Finns det någon intressant hundblo

Sidor

  • Hem
  • Bli bonusmedlem
  • Läs artiklar
  • Chatta med andra
  • Sök och erbjud jobb
  • Kontakta oss
  • Studentlicenser
  • Skriv en artikel

Statistik

Antal besökare:
Antal medlemmar:
Antal inlägg:
Online:
På chatten:
4 569 616
27 953
271 709
5 711
0

Kontakta oss

Frågor runt konsultation, rådgivning, uppdrag, rekrytering, annonsering och övriga ärenden. Ring: 0730-88 22 24 | pelle@pellesoft.se

© 1986-2013 PelleSoft AB. Last Build 4.1.7169.18070 (2019-08-18 10:02:21) 4.0.30319.42000
  • Om
  • Kontakta
  • Regler
  • Cookies