SSIS 2008 Rebuild Index Task increasing Log Size

I am testing SSIS 2008 Rebuild Index Task on a single database (db1). I shrank the
db1's log file to initial size. I also checked the box Sort results in tempdb on the SSIS package.
However, when I run the package, db1's log file size increased about 55 times the original size.
When I run a rebuild of all the index on db1
with (sort_in_tempdb=ON) ; there was only a slight increase in the log file size ( did not even double the initial size).
Is this a SSIS bug? The check box is not actually sorting in tempdb?

I am testing SSIS 2008 Rebuild Index Task on a single database (db1). I shrank the
db1's log file to initial size. I also checked the box Sort results in tempdb on the SSIS package.
However, when I run the package, db1's log file size increased about 55 times the original size.
When I run a rebuild of all the index on db1
with (sort_in_tempdb=ON) ; there was only a slight increase in the log file size ( did not even double the initial size).
Is this a SSIS bug? The check box is not actually sorting in tempdb?
Arthur can you please move this thread in Database engine forum. IMO its what changed from 2008 .Index rebuild is fully logged from 2008 onwards it was previously (in 2005) minimally logged .Refer below link for information regarding same
http://support.microsoft.com/kb/2407439/en-gb
Now about when sort intempdb is used.The intermediate sort results that are used to build the index are stored in tempdb .When you rebuild without sort_in_tempdb ( i guess your data and log file are on same drive) index will utilize disk space on which it
resides so it might seem to you log has increased.Is it so ,am i correct.
What query you used to measure log file size,are you absolutely sure it was log file that increased
Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

Similar Messages

  • Run Rebuild Index Task daily on database but about 77 tables still highly fragmented over 80% !!!

    Hello everyone
    On our particular database server, we run the Rebuild Index Task (Using classic Maintenance Plan Designer) every night. Running the  script below, I saw that about 77 tables had an avg_fragmentation_in_percentage between 80% and 99% !!
    SELECT OBJECT_NAME(ind.OBJECT_ID) AS TableName,
    ind.name AS IndexName, indexstats.index_type_desc AS IndexType,
    indexstats.avg_fragmentation_in_percent
    FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, NULL) indexstats
    INNER JOIN sys.indexes ind
    ON ind.object_id = indexstats.object_id
    AND ind.index_id = indexstats.index_id
    WHERE indexstats.avg_fragmentation_in_percent > 30--You can specify the percent as you want
    ORDER BY indexstats.avg_fragmentation_in_percent DESC
    I dont understand why these tables are highly fragmented after a daily index rebuild! Unless the users are doing heavy inserts/updates/deletes during the day.
    Anyone has an idea of the possible causes of these results??
    Thank you all in advance

    Hallo Efyuzegeekgurl,
    this is a normal behaviour when your table is only a small one. The reason for that behaviour is the following:
    The dmv sys.dm_db_index_physical_stats counts each page which is not located at the very next one of the same table as a "fragment". If the first data page is 1700 and the second one is located on 1705 SQL server will count it as a fragment.
    The basic allocation algorithm of Microsoft SQL Server is that new data pages will be created in "mixed extents". An extent is a contigious line of 8 consecutive data pages. This is for historical reasons when storage was expensive and data should
    use as much as possible of allocated storage.
    If a new table will be created the very first 8 pages are not located one after the other but "could" be located on different extents. If your table has only 9 data pages than 8 pages will count as "fragmented" because of their non consecutive
    allocation. After 8 pages have been allocated Microsoft SQL Server will ALWAYS use a full extent for the next 8 pages (and so on!).
    To understand this behaviour use the following example which creates a table with a record length of 8K. The next command will create 10 records (which means 10 data pages).
    CREATE TABLE dbo.foo
    Id INT NOT NULL IDENTITY (1, 1),
    c1 CHAR(8000) NOT NULL DEFAULT ('filler')
    GO
    SET NOCOUNT ON;
    GO
    INSERT INTO dbo.foo DEFAULT VALUES
    GO 10
    When you check the page allocation you'll find the first 8 data pages not in a consecutive row but "scrambled" into different pages:
    SELECT database_id,
    index_id,
    partition_id,
    allocation_unit_type_desc,
    extent_page_id,
    allocated_page_page_id,
    is_mixed_page_allocation,
    page_type_desc
    FROM sys.dm_db_database_page_allocations
    DB_ID(),
    OBJECT_ID('dbo.foo', 'U'),
    0,
    NULL,
    'DETAILED'
    ) AS DDDPA
    WHERE
    DDDPA.is_allocated = 1
    ORDER BY
    DDDPA.is_iam_page DESC,
    DDDPA.page_level DESC;
    GO
    You will see that the first 8 pages are located in a MIXED extent. Although the pages are in a consecutive order in the extent 221112 it is not guaranteed!
    You can see from the very first three records that they are not in a consecutive row stored.
    Now the fragmentation of the data seems to be quite high because we have 4 breaks in the rows. If we compare this value to the "fragmentation in sys.dm_db_index_physical_stats we will see at least the same result:
    SELECT index_type_desc,
    alloc_unit_type_desc,
    DDIPS.avg_fragmentation_in_percent,
    DDIPS.fragment_count,
    DDIPS.page_count,
    avg_page_space_used_in_percent
    FROM sys.dm_db_index_physical_stats
    DB_ID(),
    OBJECT_ID('dbo.foo', 'U'),
    NULL,
    NULL,
    'DETAILED'
    ) AS DDIPS;
    So - just from my point of view - don't count only to the fragmentation in percent because if the table is to small it will ALWAYS be over 30%. Take more into account the density of the pages and - as all others have mentioned - the number of pages of the
    index.
    I would consider indexes with more or equal to 1.000 pages.
    Another tip: Forget about the f... maintenance plans. These "plans" are not worth the time and money because you cannot control it in a more precise way. Have a look to the solution of Ola Hallengren and implement his solution - a great master
    piece of index maintenance:
    http://ola.hallengren.com
    All the best to the community :)
    MCM - SQL Server 2008
    MCSE - SQL Server 2012
    db Berater GmbH
    SQL Server Blog (german only)

  • Can you increase log size in directories (missed/received/placed calls etc)

                       Hi, hopefully i'm posting this in the right section.
    I've been asked by someone if its possible to increase the amount of logs held in the "placed calls" section.
    He says its convenient for him to keep more as when dialing a number, it comes up as suggested (should he of course dialed it previously).
    Hope that makes sense.
    Thanks,
    Connor

    Connor,
    That's a limitation hardcoded into the hardware of the phone.
    Rob replied to another similar post about this here: https://supportforums.cisco.com/thread/2149469
    Gareth

  • Issue in rebuilding index after restoring database from sql server 2005 to 2012

    Hi All,
    We have recently restored a database named DBA_admin from our sql server 2005 instance to sql server 2012 and we have added the database to out weekly maintenance plan. After adding the database to maintenance plan the job is failing every weekend due to
    below error message.
    Error message from maintenance plan history:
    Executing the query "ALTER INDEX [PK_lsttype] ON [dbo].[lstAssign..." failed with the following error: "Invalid object name 'admin.dbo.databaselog'.
      ALTER_INDEX - dbo.PK_lsttype". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    Below is the code within the maintenance plan which the rebuild index task is using for database dba_admin:
    USE [dba_admin]
    GO
    ALTER INDEX [PK_lstType] ON [dbo].[lstType] REBUILD PARTITION = ALL WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 98, DATA_COMPRESSION = PAGE)
    Please let me know if any one knows how to fix this issue.
    Thanks in Advance.

    Sorry for the confusion.
    Here is what is happening.
    The query is failing while trying to rebuild index [Pk_lsttype] on table [lstAssign], both these objects belong to database
    admin.
    I have verified the old instance there is table databaselog within the database
    dba_admin, but in new SQL instance within the database dba_admin the table is not present.
    Even I'm not sure of what this table databaselog has to do with rebuilding indexes on table
    lstAssign within the admin database.
    I have manually tried to execute the alter index command within the database
    admin and it is failing with the below error.
    ALTER_TABLE - dbo.Query_pnb_sms
    Msg 208, Level 16, State 1, Procedure ddlDatabaseTriggerLog, Line 39
    Invalid object name 'dba_admin.dbo.databaselog'.

  • Manage size of DHCP-Clinet Event log SIZE

    While troubleshooting DHCP –NAC problem i had to enable and increase  the size of the Microsoft-Windows-Dhcp-Client/Admin , Microsoft-Windows-Dhcp-Client/Operational, Microsoft-Windows-DNS-Client/Operational
    Because when NAC event course default size of 1MB of the log is to short, and it fills up in a seconds, and it  overwrite  first event.
    Is there any why, how to increase log size, from GPO.

    Hi,
    Where are these events logged? If these events are logged in Event Viewer, we can utilize Group Policy to change the maximum size of the log.
    The path for this policy setting is:
    GPO_name\Computer Configuration\Windows Settings\Security Settings\Event Log\
    Regarding this point, the following article and blog can be referred to for more information.
    Event Log Policy Settings
    http://technet.microsoft.com/en-us/library/cc778402(v=ws.10).aspx
    Group Policy Settings - Security Settings - Event Log
    http://vanstechelman.eu/windows/group_policy_settings/security_settings/event_log
    Please Note: Since the second website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of
    this information.
    Best regards,
    Frank Shen

  • Error while sending mail using script task in ssis 2008

    Hi,
        i am trying to send mail using ssis 2008 script task.for my requirement i am not able to use send mail task.
    code i have used is
    declared read only variables system::packagename
     Dim PACKAGE As String
            PACKAGE = Dts.Variables("System::PackageName").Value.ToString()
            Dim myHtmlMessage As MailMessage
            Dim mySmtpClient As SmtpClient
            myHtmlMessage = New MailMessage("[email protected]", "[email protected]", "PACKAGE STATUS", PACKAGE + "WAS FAILED")
         mySmtpClient = New SmtpClient("smtp.gmail.com")
            mySmtpClient.Credentials = New NetworkCredential("[email protected]", "mypassword")
            mySmtpClient.EnableSsl = True
            mySmtpClient.Port = 587
            mySmtpClient.Send(myHtmlMessage)
    error i am getting is
    Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1
    Authentication Required. Learn more at
       at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
       at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from)
       at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)
       at System.Net.Mail.SmtpClient.Send(MailMessage message)
       at ST_c121e07caaa94c21bb1355d4f753112f.vbproj.ScriptMain.Main()
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
       at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
       at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
    can any one tell me where i am going wrong

    also getting error as follows
    Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1
    Authentication Required. Learn more at
       at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
       at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from)
       at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)
       at System.Net.Mail.SmtpClient.Send(MailMessage message)
       at ST_c121e07caaa94c21bb1355d4f753112f.vbproj.ScriptMain.Main()
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
       at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
       at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()

  • SQL Logging not working in SSIS 2008

    Hello,
    I have packages created in SSIS 2008 and I am trying to enable logging in them. I specified a SQL Server provider and gave it a working SQL Server DB connection as the configuration. I chose to log all the events from the Details tab, then I executed the package. It ran without errors, but no logging occured. Actually neither the logging table, nor the stored procedure that should perform the loggign were created. These exact steps used to work with SSIS 2005 and they'd generate the table, stored proc and start storing logging information. For testing, I also added to the same package logging options a text logging and a SQL Profiler log providers. These were created successfully and have logs entered in them. I tried different DB connections on different servers, but still the table and sp are not even getting created. Any ideas?
    Best Regards,
    Ketara

    Had the same problem. When I read the documentation Microsoft explicitly states that you must use an OLEDB provider for SQL Server logging. I checked, and mine was the "SQL Server Native Client" rather than the "Microsoft OLE DB Provider for
    SQL Server". When I switched out the driver, it worked. 
    The log table is under System Tables called: dbo.sysssislog
    The stored procedure that populates the table is under System Stored Procedures called: dbo.sp_ssis_addlogentry

  • Weblogic 8.1 Server log size increase in Production environment

    Hi,
    Issue:: One of the log file is increasing in size and exceeding beyond the size mentioned in the configuration file resulting in application outage.
    Issue description:
    We are having problems with the log size in the Weblogic 8.1 server. The fileminsize has been mentioned in the config.xml.
    New log files like MYsvr.log00001,MYsvr.log00002, MYsvr.log00003, MYsvr.log00004 etc are also being generated appropriately when the max file size has been reached. But simultaneously, one of the files is growing in size, exceeding the limit mentioned in the configuration file. Eg.. the MYsvr.log00001 file is 800MB in size while the other files(MYsvr.log00002, MYsvr.log00003 etc are 10MB in size)
    This increase in size of the log has been resulting in an application outage.
    More Details:
    1. Server: BEA Weblogic 8.1 server
    2. Log size is fine in other environements. This is a problem only in the production environment.
    3. The entry in the config.xml is as follows:
    <Server ListenPort="6313" Name="MYsvr" NativeIOEnabled="true" TransactionLogFilePrefix="./">
    <ServerStart Name="MYsvr"/>
    <Log FileMinSize="10000" FileName="MYsvr.log" Name="MYsvr"
    NumberOfFilesLimited="true" RotationType="bySize"/>
    <SSL Name="MYsvr"/>
    <ServerDebug Name="MYsvr"/>
    <WebServer Name="MYsvr"/>
    <ExecuteQueue Name="default" ThreadCount="15"/>
    <KernelDebug Name="MYsvr"/>
    </Server>
    Could you please help with this issue ?
    Thank you.

    Can someone please provide a solution for the issue

  • How to increase the size of Redo log files?

    Hi All,
    I have 10g R2 RAC on RHEL. As of now, i have 3 redo log files of 50MB size. i have used redo log size advisor by setting fast_start_mttr_target=1800 to check the optimal size of the redologs, it is showing 400MB. Now, i want to increase the size of redo log files. how to increase it?
    If we are supposed to do it on production, how to do?
    I found the following in one of the article....
    "The size of the redo log files can influence performance, because the behavior of the database writer and archiver processes depend on the redo log sizes. Generally, larger redo log files provide better performance, however it must balanced out with the expected recovery time.Undersized log files increase checkpoint activity and increase CPU usage."
    I did not understand the the point however it must balanced out with the expected recovery time in the above given paragraph.
    Can anybody help me?
    Thanks,
    Praveen.

    You dont have to shutdown the database before dropping redo log group but make sure you have atleast two other redo log groups. Also note that you cannot drop active redo log group.
    Here is nice link,
    http://www.idevelopment.info/data/Oracle/DBA_tips/Database_Administration/DBA_34.shtml
    And make sure you test this in test database first. Production should be touched only after you are really comfortable with this procedure.

  • Increase current redo log size in standby database in mount stage

    We have oracle 10g standby database. The standby database is always running in mount stage while apply logs manually not data guard is used.
    We have increase size or online redo log in primary . Now want to inrease in standby database also.
    how to increase the size of current online redo log in standby database while it in mount stage .
    in mount stage we cant run alter system switch logfile

    user11965804 wrote:
    We have oracle 10g standby database. The standby database is always running in mount stage while apply logs manually not data guard is used.
    We have increase size or online redo log in primary . Now want to inrease in standby database also.
    how to increase the size of current online redo log in standby database while it in mount stage .
    in mount stage we cant run alter system switch logfilein 10g Standby will be always in Mount status when MRP is running.
    When you increase size of online redo log files in primary, You should increase in standby also..
    Standby redo log file size should be equal or higher than primary. You no need to switch log files on Standby.
    You will have only standby redo log files in standby not ORL(online redo log files)
    You can use this below script to add standby redo log files.
    http://www.pythian.com/news/581/oracle-standby-redo-logs/

  • SSIS 2008 - Sending file with dynamic name using FTP task

    Hi  - Thanks for taking a look -  (I'm very new to SSIS.)
    I'm trying to create an SSIS 2008 package that does the following:
    1) Execute a stored procedure on SQL.
    2) Download the results as a CSV file to a 'local' location.  The file name is set using a variable ("User::LocalFilePath") dynamically based on the current time:
    @[User::LocalFilePath] + "GreatReportName_" + "_" +(DT_STR,4,1252) DatePart("yyyy",getdate()) + Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) + "_" + Right("0"
    + (DT_STR,4,1252) DatePart("d",getdate()),2) + "_" + Right("0" + (DT_STR,4,1252) DatePart("hh",getdate()),2) +  "_" + Right("0" + (DT_STR,4,1252) DatePart("mi",getdate()),2)
    + "_" +  Right("0" + (DT_STR,4,1252) DatePart("ss",getdate()),2) + ".csv"
    3) Transfer the CSV file to an FTP site.
    4) Delete the CSV file from the 'local' location.
    I've been able to do steps 1 and 2 so far.  However when trying the move the newly created file to the FTP site I get the error:
    "Error: 0xC002917C at Send to FTP, FTP Task: The variable "User::LocalFilePath" doesn't contain file path(s)."
    (When I set the "IsLocalPathVariable" to "False" and use a file previously created the file is correctly transferred to the FTP site.  This proves that the FTP details are correct and that the "RemotePathVariabe" is working
    correctly.)
    I have set the variable ("User::LocalFilePath") to "EvaluateAsExpression" in the variable properties.
    Can anyone help?
    Many Thanks,
    UnoT

    Hi Vaibhav,
    Thanks for your response.  I set the "DelayValidation" to "True".  However
    that didn't make any difference.
    I added in all the breakpoints, but it didn't give any results (I may be doing this incorrectly?):
    Any other suggestions?
    Thanks,
    UnoT

  • I am handling logistics department in a company, i am handling more than 100 calls in a day. But my iPhone 4 have only 100 number call history. How to increase my call log size or kindly suggest a better app for storing 1 month call history..

    I am handling logistics department in a company, i am handling more than 100 calls in a day. But my iPhone 4 have only 100 number call history. How to increase my call log size or kindly suggest a better app for storing 1 month call history..

    Here's one:
    https://itunes.apple.com/us/app/callog/id327883585?mt=8

  • Recommended frequency for running Rebuild Indexes Maintenance task on CAS

    How frequently shall we run "Rebuild Index" maintenance task on CAS?

    You should also consider using an actual SQL index rebuild script instead of the built-in maintenance task as described at http://stevethompsonmvp.wordpress.com/2013/05/07/optimizing-configmgr-databases/
    Jason | http://blog.configmgrftw.com

  • How to Increase database / log size of mirrored database

    Hi All,
    I have been asked to increase the default database and log size of two databases, both of which are mirrored.
    I have been trying to find out what else I need to do in this case other than the standard resizing.
    Are there extra steps I need to perform as these dbs are mirrored (SQL Mirroring)?
    Farren

    Hi Farren,
    Based on my test, if you choose to expand the mirrored database by increasing the size of an existing data or log file, you can directly execute the ALTER DATABASE statement on the Principal server as Uri’s post, but before that please make sure the mirroring
    status is synchronized. You can check the mirroring configuration and partner status with the following query.
    SELECT DB_NAME(DATABASE_ID) 'DBNAME',mirroring_state,
    mirroring_state_desc,mirroring_role,mirroring_role_desc,
    mirroring_partner_name,mirroring_partner_instance
    FROM sys.database_mirroring
    WHERE mirroring_guid IS NOT NULL
    However, if you choose to expand the mirrored database by adding a new file to the database, you need to perform extra steps as follows.
       1. Check the mirroring configuration and partner status with above query.
       2. Run the below command on the principal server to break the mirror.  
    ALTER DATABASE DatabaseName SET PARTNER OFF
       3. Create your database file on the principal server.
       4. Run a log backup on the principal server.
       5. Restore this log backup on the mirrored server using the NORECOVERY and MOVE options.
       6. Re-establish mirroring between the servers for this database.
    Reference:
    Increase the Size of a Database
    How to add a database file to a mirrored SQL Server database
    Thanks,
    Lydia Zhang
    Lydia Zhang
    TechNet Community Support

  • SQLSERVER 2012 LOG SIZE INCREASE EXTENSIVELY

    Hi Friends,
    I want to inquire, as our sqlserver 2012 in full  recovery mode , I notices whenever we are executing rebuild indexes maintenancejob the logfile grown up extensively every time.  h
    thank you.
    regards,
    asad

    Hi Friends,
    I want to inquire, as our sqlserver 2012 in full  recovery mode , I notices whenever we are executing rebuild indexes maintenancejob the logfile grown up extensively every time.  h
    Asad,
    Why are you posting same thread about SQL Server log file every time. I can see all your previous threads on same Log file issue.
    This clearly shows that you don't spend event single moment reading links posted as answer. Why dont you go and read about SQL Server before asking *almost* same question every time.
    Yes log file will grow that is default behavior why are you executing index rebuild for all index. Did you searched about index rebuild and how it works and what gets logged.
    You can read here
    Curious case of logging in Online and offline index rebuild
    Use Ola Hallengren solution for index rebuild it will only rebuild index that is fragmented.
    Don't just blindly post question spend some time on net searching I am sure you would find lot of articles
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

Maybe you are looking for