MS CRM can't add users after database restore - dynamics-crm

We have restored an old ms CRM database over a newer version. But when I try and add users which were already existed in newer version I get an error.
If I delete the users from our of active directory and then try to add them to CRM it works fine.
Is it possible that CRM is storing user information in the MSCRM_CONFIG. And can this be removed in a supported way?
Have a look at the SystemUser in the MSCRM_CONFIG table, I think i need to remove the users from this table. but I can't do a delete statement as it's not supported. :)

Did you restore this database using the Deployment Manager tool or simply by doing a SQL Restore? Doing this directly from SQL would cause issues. You'll need to delete the organization in the deployment manager and then delete the database in SQL. Then you should attach the database and recreate the organization from the deployment manager, pointing it to the existing database.

Restoring just the org DB can lead to issues as some user info is stored in the config DB as well. In fact, there are entries in there mapping the user to the org (SystemUserOrganizations), so when you restore the Org DB, this mapping is now out of date.
You would need to either go the Delete/Import route or manually do some unsupported cleansing of the Config DB Tables.

Related

Visual Studio 2015 Web Test with Data from Oracle Database

I'm writing a webtest in Visual Studio 2015. The webtest I currently have allows me to run a static test.
I would like to spice things up and therefore add more realistic data. The data I want to use is stored in an Oracle Database 12c.
So I'm trying to add a new Data Source to the webtest. I enter the TNSName, Username and Password for which I would like to connect and test the connection. The connection can be established, but the list with tables I can choose from is empty.
Connecting to the same Database using the "Server Explorer" in Visual Studio 2015 works. And using this method I do get the full list of Tables contained in that Database. I can even query any of the tables.
So how can I fix my webtest to have access to a specific database table (row)?
If you can connect to the DB but you don't see the needed tables it should be a permission issue.
Do you use same credentials from "VS->Server Explorer" to connect to the DB?
If this is not the case, do you have more than one Oracle clients installed in your system? If yes, then most probably, the DataSource control uses the wrong client and the "Server Explorer" the correct one.
Are you using synonyms as proxies for your tables (e.g. for permission reasons)? synonyms will not show up when querying the list of tables that the user can access. They need be queried separately. When only the available tables are queried but not the vendor specific aliases this might lead to an empty list.
You need to install ODAC for Visual Studio 2015 to view the database tables. Here is the link for it.
http://www.oracle.com/technetwork/topics/dotnet/downloads/odacmsidownload-2745497.html

create db - prevent creation of users

On SQL Server 2008R2, we have a SQL login tagged with the sysadmin server role. Anytime a db is created, this login is automatically added as a user to the db. Is there a switch that will prevent this from happening?
EDIT:
Based on the answer below, I am adding more background info to explain why we want to do this.
When we publish to a new database from a Visual Studio SQL project, the publishing engine wants to add a user to the database. The username already exists as a login to the database (in the sysadmin server role -- and not much we can do about that), so the publish fails as the user gets auto-added by SQL server after the 'create database' statement. I was hoping for a switch that would tell SQL Server to not add the user automatically. So it seems we will have to find another solution on the VS side that tells the publishing engine to ignore the SQL DB user.
Assuming you're talking about the sql-server role, I don't think so. TBH if you're contemplating keeping a sys-admin out of a db, then you've got a different problem than the one you think you have...
I have a resolution to this. Download the latest SSDT package from MS and now there are new options under the Publishing Wizard Advanced... button to exclude the publishing of logins, roles, etc. The SSDT package I downloaded I found here...
https://msdn.microsoft.com/en-US/dn864412

What is incremental database publishing?

When I am publishing my site using Web Deploy in Visual Studio I see something like:
MySql.Data.MySqlClient is not supported for incremental database publishing.
I want to know what exactly would this technology do if it is supported?
Incremental database publishing is a deployment feature where the source code for the schema (new version) is compared with the live database schema (current version) to create a change script to upgrade the current version to the new version.
For example, if your schema has a table with a few columns and in the source code you add a new column definition, when publishing it would create a script to add the new column to the table.
It's not surprising that a database engine besides SQL Server isn't supported, since supporting other database engines would be a significant amount of work. All it really means is that you'll have to synchronize database changes yourself. MySQL may provide tools to help with this, but Visual Studio doesn't.
Incremental database publishing is used for versioning purposes. SVN can't really handle versioning for database schema like tfs can support.
If you're using incremental database publishing you can set up to keep the current database and just do the update, or to always recreate database.
Let's assume you want to declare sql variables like InitData, SeedData.
You can do this and you have access at some before and post publishing script. If your variable SeedData is true, you can seed some data in the post publishing script.
More info here: http://www.asp.net/web-forms/tutorials/deployment/web-deployment-in-the-enterprise/deploying-database-projects
EDIT: it's just the schema that's updated if you choose not to recreate your database when you publish

Screwturn wiki to point to existing database will not work

I recently moved my screwturn installation to a completely new environment (site on new IIS/server and database moved to new SQL Server).
I can succesfully open the Screwturn wiki but instead of using the existing database (that I configured in the web.config), Screwturn wants to create the DB from scratch and hence states the error that certain tables already exist in the DB.
If I create a blank DB and use this in the web.config, Screwturn will happily create its tables and use that DB. Of course, that's not what I want, I want it to use the existing, moved DB on the server.
Is there a way to tell Screwturn not to create the DB and simply "use" the existing one?
If this is not possible, are there scripts available to copy the content from the old DB to the new one (simply copying it with SQL Servers Import/Export feature gives errors (logical) that certain fields cannot be created as that will cause PK violations.
Did you use your old web.config or just update the SQL connection info in the web.config from the new version? I think you should use your old web.config (maybe compare to the new one to see if anything was added). I have done this several times with several installations and haven't had a problem.
The only other thing I can think of off-hand is if your old version is v2, then you should review the instructions here as a few things changed from v2 to v3.
Old Screwturn Wiki Site - Upgrade from v2 to v3

Change Oracle Schema at runtime when using SubSonic

In my project, I am using Oracle Database and SubSonic for DAL. I have a problem with SubSonic and Oracle Schema, that is:
When developing, I used a schema DEV in Oracle Database and generate DAL using SubSonic.
After that when release to customer, he used a new schema TEST in Oracle Database and changed the connection string in app.config to connect to Oracle. The error will appear, that is “Table or View does not exist”. I found this error and see that the schema of tables is still DEV.
I do not want re-generate DAL after change schema and when released to the customer. Please help me.
Firstly, your schema should not be DEV. DEV is a user or role.
Your schema name should be related to the data content (eg ACCOUNTS or SALES)
Secondly, consider whether you or the customer is going to decide the schema name. Say you have a product called FLINTSTONE. You may decide that the schema name should be FLINTSTONE. However your customer may want to run two instances of your product (eg one for local sales, the other for international) and use the same database. So they want FS_LOCAL and FS_INTER as the schema names. Is that option a feature of your product ?
Next, decide if your application should connect as the schema owner. There are good security reasons for NOT doing that. For example, the schema owner has privileges to drop tables, which is generally something the application doesn't do and thus, on the principle of least privilege, is something your application shouldn't have privileges to do.
Generally I would recommend some config parameter for the application for the schema name, and after connecting to the database, the app should do an "ALTER SESSION SET CURRENT_SCHEMA = 'whatever was it the config file'". The application database user would need the appropriate insert/update/delete/select/execute privileges on the objects in the application schema. If the application can't do that, you can have a LOGON trigger in the database.
Gary is correct in not using DEV as a schema on your own machine. In using Oracle we typically set up the schema as what the client is going to name their schema. This however does not fix your issue. What you need to do is create a global alias in Oracle that maps say DEV to CLIENTSCHEMA. You should still rename the schema on your machine but this will allow your schema to differ from your clients.

Resources