Adding Index server to existing farm, "Server Farm Product and Patch Status" returned 34 Missing Locally required products and patches
Once I connected my new server to my farm's config db, it returned all of the following missing locally. I stripped out any redundancies and Headings, and I'm left with 43. I'm looking for a efficient strategy. Should I start with the lowest version number
and work my way up? Current DB version is 14.0.7015.1000. IIRC, SP2 is cumulative, so can I ignore the first two (SP1 and Hotfix), install SP2, and then the Language packs and etc on top?
Sorted by version:
Microsoft SharePoint 2010 Service Pack 1 (SP1) (14.0.6029.1000)
Hotfix for Microsoft SharePoint Server 2010 (KB2775353) 64-Bit Edition (14.0.6105.5000)
Service Pack 2 for Microsoft SharePoint 2010 (KB2687453) 64-Bit Edition (14.0.7015.1000)
Service Pack 2 for Microsoft 2010 Server Language Pack (KB2687462) 64-Bit Edition (14.0.7015.1000)
Microsoft Office Server Proof (English) 2010 (14.0.7015.1000)
Microsoft Office Server Proof (French) 2010 (14.0.7015.1000)
Microsoft Office Server Proof (Russian) 2010 (14.0.7015.1000)
Microsoft Office Server Proof (Spanish) 2010 (14.0.7015.1000)
Microsoft SharePoint Portal (14.0.7015.1000)
Microsoft User Profiles (14.0.7015.1000)
Microsoft SharePoint Portal English Language Pack (14.0.7015.1000)
Microsoft Shared Components (14.0.7015.1000)
Microsoft Shared Coms English Language Pack (14.0.7015.1000)
Microsoft Slide Library (14.0.7015.1000)
Microsoft InfoPath Forms Services (14.0.7015.1000)
Microsoft InfoPath Form Services English Language Pack (14.0.7015.1000)
Microsoft Word Server (14.0.7015.1000)
Microsoft Word Server English Language Pack (14.0.7015.1000)
PerformancePoint Services for SharePoint (14.0.7015.1000)
PerformancePoint Services in SharePoint 1033 Language Pack (14.0.7015.1000)
Microsoft Visio Services English Language Pack (14.0.7015.1000)
Microsoft Visio Services Web Front End Components (14.0.7015.1000)
Microsoft Excel Services Components (14.0.7015.1000)
Microsoft Document Lifecycle Components (14.0.7015.1000)
Microsoft Excel Services English Language Pack (14.0.7015.1000)
Microsoft Search Server 2010 Core (14.0.7015.1000)
Microsoft Search Server 2010 English Language Pack (14.0.7015.1000)
Microsoft Document Lifecycle Components English Language Pack (14.0.7015.1000)
Microsoft Slide Library English Language Pack (14.0.7015.1000)
Microsoft SharePoint Server 2010 (14.0.7015.1000)
Microsoft Access Services Server (14.0.7015.1000)
Microsoft Access Services English Language Pack (14.0.7015.1000)
Microsoft Web Analytics Web Front End Components (14.0.7015.1000)
Microsoft Web Analytics English Language Pack (14.0.7015.1000)
Microsoft Excel Mobile Viewer Components (14.0.7015.1000)
Recommendations?
Thanks,
Scott
Thanks guys. I was able to get through all of the patches except for
Language Pack for SharePoint, Project Server and Office Web Apps 2010 - English missing locally
Language Pack for SharePoint, Project Server and Office Web Apps 2010 -
Spanish/Español missing locally
This was my process:
Config Wizard:
Adding Index server to existing farm, "Server Farm Product and Patch Status" returned 34 Missing Locally required products and patches.
SKIP installing the following two, as SP2 is cumulative
Microsoft SharePoint 2010 Service Pack 1 (SP1) (14.0.6029.1000) (officeserver2010sp1-kb2460045-x64-fullfile-en-us.exe)
Hotfix for Microsoft SharePoint Server 2010 (KB2775353) 64-Bit Edition (14.0.6105.5000)
install SP2 oserversp2010-kb2687453-fullfile-x64-en-us.exe
install oslpksp2010-kb2687462-fullfile-x64-en-us.exe
Got "There are no products affected by this package installed on this system."
SO!
Uninstalled Sharepoint 2010 Server
WIll try to install again, without skipping #2, and reorder installation of oslpksp2010-kb2687462-fullfile-x64-en-us.exe
Retry (the long way):
Run SharePointServer.exe, get Missing Locally...
Install oslpksp2010-kb2687462-fullfile-x64-en-us.exe SUCCESSFUL
Install officeserver2010sp1-kb2460045-x64-fullfile-en-us.exe SUCCESSFUL
Reboot
Install oserversp2010-kb2687453-fullfile-x64-en-us.exe SUCCESSFUL
Rerun Config
STILL MISSING
Download oslpksp2010-kb2687462-fullfile-x64-es-es.exe, run, "there are no products affected..."
Uninstall.
Re-retried, only got through the first couple:
Run SharePointServer.exe, get Missing Locally...
Install SP1 officeserver2010sp1-kb2460045-x64-fullfile-en-us.exe, SUCCESSFUL
Install English Lang Pack oslpksp2010-kb2687462-fullfile-x64-en-us.exe, "There are no products affected by this package installed on this system."
Install Spanish Lang Pack oslpksp2010-kb2687462-fullfile-x64-es-es.exe,
Install SP2 oserversp2010-kb2687453-fullfile-x64-en-us.exe, run Config Wizard
I'm now downloading 462150_intl_x64_zip.exe, going to try and install it as step three.
Any suggestions greatly appreciated.
Thanks,
Scott
Similar Messages
-
Adding Availability Group to Existing SQL Server 2012 Enterprise installation
Looking at an existing SQL Server 2012 Enteprise vm. We'd like to add availability group functionality. It seems that we should be able to create a second VM and install SQL on it in an identical configuration. Then create a windows cluster with
the two nodes. From there we should be able to configure avaialbility groups.
I've set up avaialbility groups before but have not retrofitted one before. It seems possible though since the instances are standalone. Anyone see a problem with doing this?
thanks
PeterHello,
What you have is pretty much it. Since AGs require clustering but do not require a clustered install (stand alone install is used) there shouldn't be any changes with the actual install. You will have to enable the HADR option in the configuration manager
once the clustering is setup.
Sean Gallardy | Blog |
Twitter -
Need to Setup Project Server in existing SharePoint 2013 farm
Hi
I have already SharePoint 2013 farm having 4-WFE Servers, 2-Application Servers, 3-dedicated Search Servers, 2-DB servers (Clustering enabled). Now I want to add one more App server having Project Server 2013 in this existing farm environment so Please
check the below steps. Please let me know If I am wrong in the approach.
Need to install PS 2013 on all the WFE, Applications and Search Servers.
Need to Run Sharepoint wizard on all the servers one by one. (Is it mandatory to run wizard on each server or should run only on application servers only)
The project Server service should run only on application servers.
Regards, Pankaj Waghmare - MCTS | ConsultantHello,
Those steps are correct for high level :) One thing you might need to do is after installing Project Server on all the servers is apply the same CU / SP to Project Server as SharePoint (using the Project Server equivalent patch) so Project Server and SharePoint
are patched at the same level. I would do this after installing PS2013 and before you run the wizard on each server.
I would ensure you test this on a non prod farm first and ensure you have a roll back plan in place.
Paul
Paul Mather | Twitter |
http://pwmather.wordpress.com | CPS -
Revision: 9317
Author: [email protected]
Date: 2009-08-14 14:13:16 -0700 (Fri, 14 Aug 2009)
Log Message:
Added ASDoc version tagging to all parts of these files where it was missing. Code builds and Checkintest passes.
Modified Paths:
flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/Channel.as
flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/MessageAgent.asThats good news.
-
What are the steps to change existing sharepoint 2010 farm database server to a new server
Hi
i have a sharepoint 2010 farm and backend with sqlserver2012 standard edition on windows server 2008 r2 server
now what are the steps to if want to connect this farm to a new sql server 2012 on windows server 2012 server and remove this existing server
adilYou have two options:
Use a SQL Alias and you will then need to swing all databases over to the new SQL Server
Don't use a SQL Alias and swing all but the Configuration and Administration databases to the new SQL Server, and individually re-configure Service Applications/Web Applications to use the new SQL Server. This will force you to keep the old SQL Server around.
Trevor Seward
Follow or contact me at...
  
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
Deploying Project Server 2013 to an Existing SharePoint 2013 Farm
We recently deployed the following for our new SharePoint 2013 farm:
2 SQL server (alwaysOn config)
2 application servers
2 WFE
1 SQL for Dedicated Search
2 WFE for Dedicated Search
2 Applications Servers for Dedicated Search.
After purchasing a company that uses Project 2013 heavily we are now looking at deploying Project 2013 using our new 2013 SharePoint farm. My question is what is the recommended additional servers that would needed to be deployed to the existing farm?
Thanks,
RicRic,
It really depends on what your current dataset is, and what the load on your SharePoint Server/Project Server. Technically, Project Server can just sit on top of your WFE and App Servers for SharePoint. You do not need a complete separate server group
for Project Server alone, unless there is a special reason to do so.
Cheers,
Prasanna Adavi, Project MVP
Blog:
Podcast:
Twitter:
LinkedIn:
-
Project Server 2010 Migratet from one farm to another farm
Hi ,
I need to migrate existing Project server 2010 farm one server to another server.
Kindly suggest me what is the best way we need to fallow.
Existing Environment two server:
1. App server(SharePoint 2010 +Project Server 2010)- Existing PWA site is running
2.Database server(with DNS instance name)
New Environment:
1.App server (fresh installed SharePoint + project server 2010)
2.DB server fresh server with sql 2008
Hasan Jamal Siddiqui(MCTS,MCPD,ITIL@V3),Sharepoint and EPM Consultant,TCS
|
| TwitterEvent viewer Error:
Failed to provision site PWA with error: Microsoft.Office.Project.Server.Administration.ProvisionException: Membership synchronization failed. ---> System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at Microsoft.SharePoint.Library.SPRequest.RemoveRoleDef(String bstrUrl, Int32 lRoleID)
at Microsoft.SharePoint.SPRoleDefinitionCollection.Delete(SPRoleDefinition roleDefinition)
at Microsoft.Office.Project.Server.BusinessLayer.SharePointSecurityHelper.DeleteRoleByName(SPWeb web, String roleName)
at Microsoft.Office.Project.Server.BusinessLayer.SharePointSecurityHelper.DeleteRoles(SPWeb web)
at Microsoft.Office.Project.Server.BusinessLayer.SharePointSecurityHelper.ConfigureDefaultPWAWSSSecurityModel(SPSite topSite, SPWeb web)
at Microsoft.Office.Project.Server.BusinessLayer.Admin.<>c__DisplayClass18.<QueueUpdateUsersAddRemoveStatusOnPwaRootsAndWorkspaces>b__17()
at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
at Microsoft.Office.Project.Server.BusinessLayer.Admin.QueueUpdateUsersAddRemoveStatusOnPwaRootsAndWorkspaces(Dictionary`2 deletedUserUidsLoginNames, Guid[] addedUserUids, Boolean isFullSync, Boolean syncWorkspaces)
at Microsoft.Office.Project.Server.BusinessLayer.Admin.SynchronizeMembershipForPwaAppRootSite()
at Microsoft.Office.Project.Server.Administration.PsiServiceApplication.SynchronizePwaMembership(ProjectProvisionSettings provset, ProjectSite projectSite)
--- End of inner exception stack trace ---
at Microsoft.Office.Project.Server.Administration.PsiServiceApplication.SynchronizePwaMembership(ProjectProvisionSettings provset, ProjectSite projectSite)
at Microsoft.Office.Project.Server.Administration.PsiServiceApplication.CreateSite(ProjectProvisionSettings provset
Hasan Jamal Siddiqui(MCTS,MCPD,ITIL@V3),Sharepoint and EPM Consultant,TCS
|
| Twitter -
Logging into a specific server in a terminal server farm
We have several terminal server farms and in each farm we have the need for 1 user to always log into a specific server in the farm. This is due to a little piece of sortware that is required for a device that only this one user has and
the fact the it is licensed to only one server. The user must use that server for it to work. I want to include this server in the farm because it seems silly to have a server for only one user. How can I point one PC/user
to the same server in the farm all the time? We are using the Connection Broker and NLB which seems to work just fine for all other users.
ThanksHi Steve,
What operating system version are you running on your servers? Server 2008 R2? Server 2012?
When you configure a RDS farm to be load-balanced by the connection broker, all servers in the unique farm are intended to have the exact same applications installed. The idea is the RDCB can redirect users to different servers as needed to balance
the load, and that you may take any particular server (or servers, if you have enough) offline and your farm will still work.
Now, there are always exceptions and I understand it would be nice if you could assign a user/app to a specific server to handle a case like yours. For example, you would understand this particular user or app would not be load-balanced or highly
available and if the one server was down it would not work, but other users/RemoteApps would be load-balanced as usual. This is
not a feature of the current versions of RDS.
To do what you want the "best way" would require writing a custom plugin for RDCB. In your custom plugin you would specifiy the load-balancing logic. For example, when one of the "special" users logs on, your logic would direct them to the
correct specific server, but when a regular user logs on you would allow the normal RDCB load-balancing logic to apply. Please see here for more information:
Terminal Services Session Broker Plug-in reference
http://msdn.microsoft.com/en-us/library/windows/desktop/cc644962(v=vs.85).aspx
Besides writing a custom plugin I suggest you consider the following workarounds:
1. Instead of running the app under RDSH, run it in a Win7/Win8 VM pool if possible. Either a pool of identical VMs or assign each user that needs to run the app to a dedicated VM. Downside of this is added complexity, licensing for VDI,
and an increase in hardware resources required to run the VMs.
2. Have the user connect to the server using /admin. You can change the permissions so that a specific group may connect using a /admin connection, without them being administrators. Downside of this is that some features
of RDSH are not present when connected as an administrative RDP session, and only two Active admin sessions are permitted.
3. If running Server 2008 R2 you could set the server so that it does not participate in load balancing and have the users that need to run this special app connect directly to the server's ip address instead of to the farm name. Downside of this
is that you will get more uneven load distribution, however, it may not be that bad if you are balancing your initial connections using NLB and you have all of your regular users connecting to the farm name as usual.
4. Have a separate server in each farm (not joined to the farm) just for this one app. If possible they could be VMs with not much resources dedicated to each. I know this is what you did not want to do, but I mention it because an
extra base Windows Server license, one for each farm, is likely less additional cost than licensing the special software on
all servers. If you can run the app in VMs then the additional hardware cost of doing it this way is reduced.
-TP -
Adding new Hub Transport server in existing environment
Hi everyone,
Currently we have 5 exchange servers 2010 :
2 CAS Servers (Virtual)
2 MB and Hub Transport servers (Physical)
1 Edge server in DMZ. (Virtual)
Now I have added 2 more servers
with MB and Hub Tranport Roles (VIRTUAL) and want to configure the mail flow from these new transport servers.
Can anyone help with the steps I should follow. Please note we have 1 existing Edge server in 2010 and email flow should be from Hub Transport to Edge server then from Edge to internet.
Existing environment is working fine without any issues. Main reason to do this is to virtualize the physical servers. Mailbox DB already migrated to new servers.
Thanks.
Manish Kumar MCSA, MCITP Enterprise Admin. MCTS Exchange server 2007, MCITP Virtualization Admin.Dear Manish
Please find your answers below
For mail flow to happen through new hub transport I will make the new edge subscription from new HUB server
to Edge server. Is there any other changes I have to do ?
No other changes is required
Create a new edge subscription and then import it and run start endge sync
So when I will do create the new edge subscription then it will delete the old send connectors and will
create the new one?
IT will create old edge sync and create a new edge sync which will not make any impact on your config
Will there be any downtime while doing this activity ?
Better to do this on after production hours since definitely there will be mail delay and may delay more if you try this on production hours
Remember to mark as helpful if you find my contribution useful or as an answer if it does answer your question.That will encourage me - and others - to take time out to help you Check out my latest blog posts on http://exchangequery.com Thanks Sathish (MVP) -
Question on adding new server to existing pool in OVM 2.2 environment
I have an existing iscsi based server pool with one server attached to the pool. I am adding a second ovm server. I have configured the iscsi and multipath modules and can see the repository lun.
I then added the server to the pool via ovm manager, but the server is not fully participating as the agent did not create a mount point for /OVS so I can't see the repos directiories from the new server. A "df" does not show the device as it does on the first server.
The manager gui does show the server as part of the pool even though we received an error.
In the ovm manager log, we see the following messages.
Check prerequisites to add server (ovm2.highlinehosting.com) to server pool (san_pool1) succeed
During adding servers ([ovm2.domain.com]) to server pool (san_pool1), Cluster setup failed: (OVM-1011 OVM Manager communication with ovm1.domain.com for operation HA Setup for Oracle VM Agent 2.2.0 failed: errcode=00000, errmsg=Unexpected error: <Exception: ha_check_cpu_compatibility failed:<Exception: CPU not compatible! {'ovm1.domain.com': 'vendor_id=GenuineIntel;cpu_family=6;model=44', 'ovm2.highlinehosting.com': 'vendor_id=GenuineIntel;cpu_family=6;model=46'}> )
I'm not sure why it's complaining about cpu compatibility as we are not using any HA features at this time, and both servers are identical in make and model. They are both equipped with the same cpu type and speed.
I checked ocfs2 network connectivity by executing the command "nc -zv nodename 7777", which ran successfully from both nodes. The manager was able to propagate a valid cluster.conf file to both servers. I restarted the ovs-agent service on the new server.
Are there any other configuration steps that I need to take on the new server before trying to add it to the pool? I do need to tread carefully as I have live guests running in the pool.
ThxBob Weinmann wrote:
If I have to go the route of using a separate pool for each server, do you have any suggestions on how I would be able to access the repos of server1 from server2 if server1 were to go down hard? I don't mean to access it as a repos for running the vms, but just to be able to copy the vm files over to the running server.This would be possible if you were using NFS for your storage, but not if you're using FC or iSCSI, as the LUN is formatted with the OCFS2 cluster ID of each pool, so probably wouldn't be able to be mounted by another pool. Your best bet is to upgrade to Oracle VM 3.0 so that you can create a pool that contains both servers: you won't have live migration, but HA will still work just fine. -
Adding a management server and a gateway server in existing management group
we have a scom2012R2 management group in which a management server sits in forest/domain A and a gateway server in forest/domain B, C, D, etc.
Now we want to add a second management server in forest/domain A and a second gateway server in forest/domain B.
My understanding is to add a second management server in domain A, I just need to run the setup wizard and join it in to the existing management group. I also need to import the certificate in the new MS. Is this right?
When adding the second gateway server, do I have to run the gateway approve tool on the first management server?
Thanks in advanceYes, you are right, But to add a second management server in domain A, this server must join domain A.
To configure additional management server, you can refer below link
http://technet.microsoft.com/en-us/library/hh284673.aspx
And Also for adding second gateway, you will need to run gateway approve tool on the first management server and implement certificate.
http://technet.microsoft.com/en-us/library/hh456445.aspx
Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer" -
The license state for the current server doesn't match the farm's license state
I am trying to build a development Server, to mirror our Production Server.
I have copied the Config_Database and WSS_Content from our Production Server to a Development Server that is on a separate network. I installed SharePoint 2010 and ran the Config Wizard, entered in the database server and chose the Config_database that I
copied over previously.
But I receive the error:
"The license state for the current server doesn't match the farm's license state"
Can anyone help me with this.
dfrancisHi,
Please have a look at links below:
https://sharelockpoint.wordpress.com/2014/01/09/sharepoint-2013-installation-error-the-current-server-cannot-be-joined-to-this-farm/
http://blogs.msdn.com/b/sowmyancs/archive/2012/08/08/the-license-state-for-the-current-server-doesn-t-match-the-farm-s-license-state-sharepoint-psconfig-error.aspx
Hope it helps!
Thanks,
Avni Bhatt
If this helped you resolve your issue, please mark it Answered -
New-PowerPivotServiceApplication : The PowerPivot System Service does not exist in the farm
PS C:\Users\_svc_admin> New-PowerPivotServiceApplication -ServiceApplicationName $AppPoolName -DatabaseServerName $DatabaseServer -DatabaseName $DatabaseName -AddtoDefaultProxyGroup:$true
New-PowerPivotServiceApplication : The PowerPivot System Service does not exist in the farm. At line:1 char:1
+ New-PowerPivotServiceApplication -ServiceApplicationName $AppPoolName -DatabaseS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : InvalidData: (Microsoft.Analy...viceApplication:
NewPowerPivotServiceApplication) [New-PowerPivotServiceApplication], Gemin
iException
+ FullyQualifiedErrorId : Microsoft.AnalysisServices.SPAddin.PowerShell.Ne
wPowerPivotServiceApplication
Installation created these files on (14\TEMPLATE\SQL) different folder than
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\SQL
PowerPivotDbLogic.sql
PowerPivotDbSchema.sql
I copied the files to the correct location and it worksPS C:\Users\_svc_admin> New-PowerPivotServiceApplication -ServiceApplicationName $AppPoolName -DatabaseServerName $DatabaseServer -DatabaseName $DatabaseName -AddtoDefaultProxyGroup:$true
New-PowerPivotServiceApplication : The PowerPivot System Service does not exist in the farm. At line:1 char:1
+ New-PowerPivotServiceApplication -ServiceApplicationName $AppPoolName -DatabaseS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : InvalidData: (Microsoft.Analy...viceApplication:
NewPowerPivotServiceApplication) [New-PowerPivotServiceApplication], Gemin
iException
+ FullyQualifiedErrorId : Microsoft.AnalysisServices.SPAddin.PowerShell.Ne
wPowerPivotServiceApplication
Installation created these files on (14\TEMPLATE\SQL) different folder than
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\SQL
PowerPivotDbLogic.sql
PowerPivotDbSchema.sql
I copied the files to the correct location and it works -
Can not add new VMS into existing clustered server pool
For some reason, we reinstall VMM (3.1.1-416) with existing UUID and rediscover all VMSs. The process went smooth and the whole system looks clean without dead objects any more. The guest VMs are all working fine. However, the new added VMS in unassigned servers are not displayed in the "Available Servers" when we want to add into existing clustered server pool, but it is shown when we add into unclustered server pool. Anyone has clue or possible way to debug what's wrong.
Thanks,
Shun-Jee LiuThe issue is resolved. The access group in shared iSCSI is not properly configured.
-
Get definition of an index from query in SQL Server
Hi,
I need to get definition of an index using query in SQL Server 2008 as we can get definition of a stored procedure using sp_helptext command.
Thanks In advance,
JiteshI have worked on the script and updated the script as per my need. Now I am able to generate the script for a specific index. Here is the script:-
CREATE PROCEDURE ScriptCreateDropIndexes_SP
@TableName SYSNAME
,@SchemaName SYSNAME = 'dbo'
,@SORT_IN_TEMPDB VARCHAR(3) = 'OFF'
,@DROP_EXISTING VARCHAR(3) = 'OFF'
,@STATISTICS_NORECOMPUTE VARCHAR(3) = 'OFF'
,@ONLINE VARCHAR(3) = 'OFF'
,@Index_Name NVARCHAR(1000)
,@is_Create int = 0
AS
Parameters
@Schemaname - SchemaName to which the table belongs to. Default value 'dbo'.
@Tablename - TableName for which the Indexes need to be scripted.
@SORT_IN_TEMPDB - Runtime value for SORT_IN_TEMPDB option in create index.
Valid Values ON \ OFF. Default = 'OFF'
@DROP_EXISTING - Runtime value for DROP_EXISTING option in create index.
Valid Values ON \ OFF. Default = 'OFF'
@STATISTICS_NORECOMPUTE - Runtime value for STATISTICS_NORECOMPUTE option in create index.
Valid Values ON \ OFF. Default = 'OFF'
@ONLINE - Runtime value for ONLINE option in create index.
Valid Values ON \ OFF. Default = 'OFF'
SET NOCOUNT ON
IF @SORT_IN_TEMPDB NOT IN ('ON','OFF')
BEGIN
RAISERROR('Valid value for @SORT_IN_TEMPDB is ON \ OFF',16,1)
RETURN
END
IF @DROP_EXISTING NOT IN ('ON','OFF')
BEGIN
RAISERROR('Valid value for @DROP_EXISTING is ON \ OFF',16,1)
RETURN
END
IF @STATISTICS_NORECOMPUTE NOT IN ('ON','OFF')
BEGIN
RAISERROR('Valid value for @STATISTICS_NORECOMPUTE is ON \ OFF',16,1)
RETURN
END
IF @ONLINE NOT IN ('ON','OFF')
BEGIN
RAISERROR('Valid value for @ONLINE is ON \ OFF',16,1)
RETURN
END
DECLARE @IDXTable TABLE
Schema_ID INT
,Object_ID INT
,Index_ID INT
,SchemaName SYSNAME
,TableName SYSNAME
,IndexName SYSNAME
,IsPrimaryKey BIT
,IndexType INT
,CreateScript VARCHAR(MAX) NULL
,DropScript VARCHAR(MAX) NULL
,ExistsScript VARCHAR(MAX) NULL
,Processed BIT NULL
INSERT INTO @IDXTable
Schema_ID
,Object_ID
,Index_ID
,SchemaName
,TableName
,IndexName
,IsPrimaryKey
,IndexType
SELECT ST.Schema_id
,ST.Object_id
,SI.Index_id
,SCH.Name
,ST.Name
,SI.Name
,SI.is_primary_key
,SI.Type
FROM SYS.INDEXES SI
JOIN SYS.TABLES ST
ON SI.Object_ID = ST.Object_ID
JOIN SYS.SCHEMAS SCH
ON SCH.schema_id = ST.schema_id
WHERE SCH.Name = 'dbo'
AND ST.Name = 'group_master'
AND SI.name = 'uq_group_master__parent_id'
AND SI.Type IN (1,2,3)
DECLARE @SchemaID INT
DECLARE @TableID INT
DECLARE @IndexID INT
DECLARE @isPrimaryKey BIT
DECLARE @IndexType INT
DECLARE @CreateSQL VARCHAR(MAX)
DECLARE @IndexColsSQL VARCHAR(MAX)
DECLARE @WithSQL VARCHAR(MAX)
DECLARE @IncludeSQL VARCHAR(MAX)
DECLARE @WhereSQL VARCHAR(MAX)
DECLARE @SQL VARCHAR(MAX)
DECLARE @DropSQL VARCHAR(MAX)
DECLARE @ExistsSQL VARCHAR(MAX)
DECLARE @IndexName SYSNAME
DECLARE @TblSchemaName SYSNAME
SELECT @TblSchemaName = QUOTENAME(@Schemaname) + '.' + QUOTENAME(@TableName)
SELECT @CreateSQL = ''
SELECT @IndexColsSQL = ''
SELECT @WithSQL = ''
SELECT @IncludeSQL = ''
SELECT @WhereSQL = ''
WHILE EXISTS(SELECT 1
FROM @IDXTable
WHERE CreateScript IS NULL)
BEGIN
SELECT TOP 1 @SchemaID = Schema_ID
,@TableID = Object_ID
,@IndexID = Index_ID
,@isPrimaryKey = IsPrimaryKey
,@IndexName = IndexName
,@IndexType = IndexType
FROM @IDXTable
WHERE CreateScript IS NULL
AND SchemaName = @SchemaName
AND TableName = @TableName
ORDER BY Index_ID
IF @isPrimaryKey = 1
BEGIN
SELECT @ExistsSQL = ' EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N''' + @TblSchemaName + ''') AND name = N''' + @IndexName + ''')'
SELECT @DropSQL = ' ALTER TABLE '+ @TblSchemaName + ' DROP CONSTRAINT [' + @IndexName + ']'
END
ELSE
BEGIN
SELECT @ExistsSQL = ' EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N''' + @TblSchemaName + ''') AND name = N''' + @IndexName + ''')'
SELECT @DropSQL = ' DROP INDEX [' + @IndexName + '] ON ' + @TblSchemaName
END
IF @IndexType IN (1,2)
BEGIN
SELECT @CreateSQL = CASE
WHEN SI.is_Primary_Key = 1 THEN
'ALTER TABLE ' + @TblSchemaName
+ ' ADD CONSTRAINT [' + @IndexName + '] PRIMARY KEY ' + SI.type_desc
WHEN SI.Type IN (1,2) THEN
' CREATE ' + CASE SI.is_Unique
WHEN 1 THEN ' UNIQUE ' ELSE '' END + SI.type_desc + ' INDEX ' + QUOTENAME(SI.Name) + ' ON ' + @TblSchemaName
END
,@IndexColsSQL = ( SELECT SC.Name + ' '
+ CASE SIC.is_descending_key
WHEN 0 THEN ' ASC '
ELSE 'DESC'
END + ','
FROM SYS.INDEX_COLUMNS SIC
JOIN SYS.COLUMNS SC
ON SIC.Object_ID = SC.Object_ID
AND SIC.Column_ID = SC.Column_ID
WHERE SIC.OBJECT_ID = SI.Object_ID
AND SIC.Index_ID = SI.Index_ID
AND SIC.is_included_column = 0
ORDER BY SIC.Key_Ordinal
FOR XML PATH('')
,@WithSQL =' WITH (PAD_INDEX = ' + CASE SI.is_padded WHEN 1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' IGNORE_DUP_KEY = ' + CASE SI.ignore_dup_key WHEN 1
THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' ALLOW_ROW_LOCKS = ' + CASE SI.Allow_Row_Locks WHEN
1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' ALLOW_PAGE_LOCKS = ' + CASE SI.Allow_Page_Locks WHEN
1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
CASE SI.Type WHEN 2 THEN 'SORT_IN_TEMPDB = ' + @SORT_IN_TEMPDB
+',DROP_EXISTING = ' + @DROP_EXISTING + ',' ELSE '' END +
CASE WHEN SI.Fill_Factor > 0 THEN ' FILLFACTOR =
' + CONVERT(VARCHAR(3),SI.Fill_Factor) + ',' ELSE '' END +
' STATISTICS_NORECOMPUTE = ' + @STATISTICS_NORECOMPUTE
+ ', SORT_IN_TEMPDB = ' + @SORT_IN_TEMPDB +
', ONLINE = ' + @ONLINE + ') ON ' + QUOTENAME(SFG.Name)
,@IncludeSQL = ( SELECT QUOTENAME(SC.Name) + ','
FROM SYS.INDEX_COLUMNS SIC
JOIN SYS.COLUMNS SC
ON SIC.Object_ID = SC.Object_ID
AND SIC.Column_ID = SC.Column_ID
WHERE SIC.OBJECT_ID
= SI.Object_ID
AND SIC.Index_ID = SI.Index_ID
AND SIC.is_included_column = 1
ORDER BY SIC.Key_Ordinal
FOR
XML PATH('')
,@WhereSQL = SI.Filter_Definition
FROM SYS.Indexes SI
JOIN SYS.FileGroups SFG
ON SI.Data_Space_ID =SFG.Data_Space_ID
WHERE Object_ID = @TableID
AND Index_ID = @IndexID
SELECT @IndexColsSQL = '(' + SUBSTRING(@IndexColsSQL,1,LEN(@IndexColsSQL)-1) + ')'
IF LTRIM(RTRIM(@IncludeSQL)) <> ''
SELECT @IncludeSQL = ' INCLUDE (' + SUBSTRING(@IncludeSQL,1,LEN(@IncludeSQL)-1) + ')'
IF LTRIM(RTRIM(@WhereSQL)) <> ''
SELECT @WhereSQL = ' WHERE (' + @WhereSQL + ')'
END
IF @IndexType = 3
BEGIN
SELECT @CreateSQL = ' CREATE ' + CASE
WHEN SI.Using_xml_index_id IS NULL THEN ' PRIMARY '
ELSE '' END
+ SI.type_desc + ' INDEX ' + QUOTENAME(SI.Name) + ' ON ' + @TblSchemaName
,@IndexColsSQL = ( SELECT SC.Name + ' '
+ ','
FROM SYS.INDEX_COLUMNS SIC
JOIN SYS.COLUMNS SC
ON SIC.Object_ID = SC.Object_ID
AND SIC.Column_ID = SC.Column_ID
WHERE SIC.OBJECT_ID = SI.Object_ID
AND SIC.Index_ID = SI.Index_ID
AND SIC.is_included_column = 0
ORDER BY SIC.Key_Ordinal
FOR XML PATH('')
,@WithSQL =' WITH (PAD_INDEX = ' + CASE SI.is_padded WHEN 1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' ALLOW_ROW_LOCKS = ' + CASE SI.Allow_Row_Locks WHEN
1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
' ALLOW_PAGE_LOCKS = ' + CASE SI.Allow_Page_Locks WHEN
1 THEN 'ON' ELSE 'OFF' END + ',' + CHAR(13) +
CASE SI.Type WHEN 2 THEN 'SORT_IN_TEMPDB = OFF,DROP_EXISTING
= OFF,' ELSE '' END +
CASE WHEN SI.Fill_Factor > 0 THEN ' FILLFACTOR =
' + CONVERT(VARCHAR(3),SI.Fill_Factor) + ',' ELSE '' END +
'SORT_IN_TEMPDB = OFF ' + ') '
,@IncludeSQL = ' USING XML INDEX [' + (SELECT Name
FROM SYS.XML_Indexes SIP
WHERE SIP.Object_ID = SI.Object_ID
AND SIP.Index_ID = SI.Using_XML_Index_ID) + '] FOR PATH '
FROM SYS.XML_Indexes SI
WHERE SI.Object_ID = @TableID
AND SI.Index_ID = @IndexID
SELECT @IndexColsSQL = '(' + SUBSTRING(@IndexColsSQL,1,LEN(@IndexColsSQL)-1) + ')'
END
SELECT @CreateSQL = @CreateSQL
+ @IndexColsSQL + CASE WHEN @IndexColsSQL <> '' THEN CHAR(13) ELSE ''
END
+ ISNULL(@IncludeSQL,'') + CASE WHEN @IncludeSQL <> '' THEN CHAR(13) ELSE
'' END
+ ISNULL(@WhereSQL,'') + CASE WHEN @WhereSQL <> '' THEN CHAR(13) ELSE
'' END
--+ @WithSQL
UPDATE @IDXTable
SET CreateScript = @CreateSQL
,DropScript = @DropSQL
,ExistsScript = @ExistsSQL
WHERE Schema_ID = @SchemaID
AND Object_ID = @TableID
AND Index_ID = @IndexID
END
-- PRINT REPLICATE('-',100)
-- PRINT 'DROP Indexes'
-- PRINT REPLICATE('-',100)
if @is_Create = 0
begin
UPDATE @IDXTable
SET Processed = 0
WHERE SchemaName = @SchemaName
AND TableName = @TableName
WHILE EXISTS(SELECT 1
FROM @IDXTable
WHERE ISNULL(Processed,0) = 0
AND SchemaName = @SchemaName
AND TableName = @TableName )
BEGIN
SELECT @SQL = ''
SELECT TOP 1 @SchemaID = Schema_ID
,@TableID = Object_ID
,@IndexID = Index_ID
,@SQL = 'IF ' + ExistsScript + CHAR(13) + DropScript + CHAR(13)
FROM @IDXTable
WHERE ISNULL(Processed,0) = 0
AND SchemaName = @SchemaName
AND TableName = @TableName
ORDER BY IndexType DESC,Index_id DESC
PRINT @sql
UPDATE @IDXTable
SET Processed = 1
WHERE Schema_ID = @SchemaID
AND Object_ID = @TableID
AND Index_ID = @IndexID
END
end
--PRINT REPLICATE('-',100)
--PRINT 'Create Indexes'
-- PRINT REPLICATE('-',100)
if @is_Create = 1
begin
UPDATE @IDXTable
SET Processed = 0
WHERE SchemaName = @SchemaName
AND TableName = @TableName
WHILE EXISTS(SELECT 1
FROM @IDXTable
WHERE ISNULL(Processed,0) = 0
AND SchemaName = @SchemaName
AND TableName = @TableName )
BEGIN
SELECT @SQL = ''
SELECT TOP 1 @SchemaID = Schema_ID
,@TableID = Object_ID
,@IndexID = Index_ID
,@SQL = 'IF NOT ' + ExistsScript + CHAR(13) + CreateScript + CHAR(13)
FROM @IDXTable
WHERE ISNULL(Processed,0) = 0
AND SchemaName = @SchemaName
AND TableName = @TableName
ORDER BY IndexType DESC,Index_id DESC
PRINT @sql
UPDATE @IDXTable
SET Processed = 1
WHERE Schema_ID = @SchemaID
AND Object_ID = @TableID
AND Index_ID = @IndexID
END
end
Maybe you are looking for
-
Hi, I am triggering a mail using the function module SO_NEW_DOCUMENT_ATT_SEND_API1, where in the subject of the mail is passed using the DOC_CHNG-OBJ_DESCR, here the object_descr can only accomadate 50 characters. But requirement is to have more than
-
Error 3194 won't let me restore iPhone 4
The problem with this is that when I click on more info after iTunes says it won't let me restore...if I use terminal and try to edit the host file, there is no host file to edit. I get passed typing in my admin password and then it show the file: pr
-
Settings In Walkman not working after update to Android 4.3
Hi Guys, i just recently updated my Z1 from 4.2.2 to 4.3 and whenever I choose Settings inside Walkman, it says "Unfortunately, Walkman has stopped working". Can you please help?
-
Trying to get 4 clips on the screen at once for school project - HELP!!!:)
Hi there, I am trying to finish a school project about a fieldtrip which we have been on over the past few days and want four clips from the movie I have made to be on in the background while the title comes on the screen for each day. Can anyone hel
-
How to Memorise previous keynote presentations under mountain lion
If i make from AN existing keynote presentation a new slide, how can i Memorise both presentations ( old and new). Now by closing keynote hè save auto the modified last one, and i lost my previous one! Please help me