Tuesday, February 16, 2016

The "deploytoreportsservertask" failed unexpectedly. SSRS deployment fails.

Please GOTO Computer properties and follow the below steps:


Credits: http://axwiki.blogspot.com/2015/04/deploying-ssrs-from-vs-2010-solved.html#comment-form

Tuesday, February 9, 2016

SQL Server 2008 error (Operating system error 2(The system cannot find the file specified.)

I faced this error while installing and configuring Sharepoint 2013 Foundation for a client. I tried installing SP 2013 Foundation and it succeeded but the SQL Server component had failed even after many attempts. So I installed SQL Server 2008 Express with SP2 first and then installed SP 2013 Foundation. Now the installation was successful but I kept getting an error when trying to restart SQL service. the exact error was:

FileMgr:tartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'e:\sql10_main_t\sql\mkmastr\databases\objfre\i386\modellog.ldf'. Diagnose and correct the operating system error, and retry the operation.


So after few hours of installing/uninstalling and tweaking I got a solution:


NET START MSSQL$SQLEXPRESS /f /T3608


SQLCMD -S .\SQLEXPRESS

1>SELECT name, physical_name, state_desc FROM sys.master_files ORDER BY database_id;

Now notice those wrong file names, and run following commands ...

Note: you need to change the file name location.


1>ALTER DATABASE model MODIFY FILE ( NAME = modeldev, FILENAME = 'c:\model.mdf');
2>ALTER DATABASE model MODIFY FILE ( NAME = modellog, FILENAME = 'c:\modellog.ldf');
3> go

ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBData, FILENAME = 'c:\MSDBData.mdf');
ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBLog, FILENAME = 'c:\MSDBLog.ldf');

ALTER DATABASE tempdb MODIFY FILE ( NAME = tempdev, FILENAME = 'c:\temp.mdf');
ALTER DATABASE tempdb MODIFY FILE ( NAME = templog, FILENAME = 'c:\temp.ldf');

go

exit;

NET STOP MSSQL$SQLEXPRESS 





Changing the paths as described above worked, but still I was not able to log in.

My solution:

I started the service with NET START again and listed the users:
select loginname from master..syslogins
My windows account was missing, so I have added it:>
CREATE LOGIN [COMPUTERNAME\USERNAME] FROM WINDOWS;
Then I was able to login with Management Studio with Windows Authentication.


Still not being able to use the 'sa' account with the password supplied during the installation. Solution: login as 'sa' and leave the password empty. Then I could change the password to desired value.


Credit: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/54bbcac3-41c5-4a5d-a4f6-2669e538dc82/sqlserver-2008-express-install-error?forum=sqlexpress

Not able to login to SQL

Scenarios when this might happen:

You are working as a trusted DBA responsible for some extremely important SQL Servers for your company. For the sake of security, you have performed the following steps to secure SQL Servers:

You have removed any and all built-in administrators account from SQL Server logins
You have removed all the users (except SA) that were part of SYSADMIN server role (Including any Windows Accounts and/or SQL Server logins)
You have set the password of SA to something extremely complex which is hard to remember.
For day-to-day operations on SQL Server, you use your domain user account which has DBO permissions on couple of databases but doesn’t have SYSADMIN privileges.
Since you set the SA password to be complex and you have not been using it, you forgot the SA password. You are the only person in the company who would know the SA password and now you have lost the SA password.

What would you do now?

Some quick options I can think of are listed below:

1. You will try to look for the SA password on your computer hard-drive or in your emails (If you stored it in some file which is a bad practice)

2. You will rebuild Master database or reinstall SQL Server and attach all the user databases. However, this could take some time and also doesn’t guarantee that all your logins, users, permissions and server configurations will be recovered unless you plan to restore the Master database from an old backup. However, as you don’t remember the SA password, restoring the Master database will not help you and you are back to square one.

3. You will call up Microsoft PSS

You are now running out of options. What would you do?

There’s a way with which you can gain SYSADMIN access to your SQL Server. However, that would mean your Windows account will need to be a member of the local administrators group.

SQL Server allows any member of Local Administrators group to connect to SQL Server with SYSADMIN privileges.

Here are the steps you will need to perform:

1. Start the SQL Server instance using single user mode (or minimal configuration which will also put SQL Server in single user mode)

From the command prompt type: SQLServr.Exe –m (or SQLServr.exe –f)



Note: If the Binn folder is not in your environmental path, you’ll need to navigate to the Binn folder.

(Usually the Binn folder is located at: C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn)

2. Once SQL Server service has been started in single user mode or with minimal configuration, you can now use the SQLCMD command from command prompt to connect to SQL Server and perform the following operations to add yourself back as an Admin on SQL Server instance.

SQLCMD –S <Server_Name\Instance_Name>

You will now be logged in to SQL Server as an Admin.

3. Once you are logged into the SQL Server using SQLCMD, issue the following commands to create a new account or add an existing login to SYSADMIN server role.

To create a new login and add that login to SYSADMIN server role:

1> CREATE LOGIN ‘<Login_Name>’ with PASSWORD=’<Password>’

2> go

1> SP_ADDSRVROLEMEMBER '<Login_Name>','SYSADMIN'

2>go

To add an existing login to SYSADMIN server role, execute the following:

1> SP_ADDSRVROLEMEMBER ‘<LOGIN_NAME>’,’SYSADMIN’

The above operation will take care of granting SYSADMIN privileges to an existing login or to a new login.

4. Once the above steps are successfully performed, the next step is to stop and start SQL Server services using regular startup options. (This time you will not need –f or –m)

Note: Those that might be thinking this might make it easy for anyone to get access to SQL Server, well remember that you do have Auditing and will have control of who gets access to the local servers administrators group. If you haven't enable controls at that level then you may have bigger security issues in hand!!!

Credit: http://blogs.technet.com/b/sqlman/archive/2011/06/14/tips-amp-tricks-you-have-lost-access-to-sql-server-now-what.aspx

SQL single user mode (DAC: Dedicated Administrator Connection)

If you are stuck with SQL Single server connection mode then you can use DAC (Dedicated Administrator Connection) to the rescue:
  1. Go to New Query.
  2. Type the following into the Server Name dialog box: ADMIN:ServerName\InstanceName (eg: ADMIN:MSSQL\SQLDEV).
  3. Now you can run any scripts needed against your database in Single User Mode.

System restart from previous installation or update is pending

Today while installing Sharepoint 2013 Foundation in our web server I faced an error which says: 
System restart from previous installation or update is pending. Restart your computer and run setup to contiue.


I tried restarting but it didn't work and I understood that it's a trap so started what I am good at "Googling" for solution. Here it is:

  • Open the Registry editor (run > regedit)
  • Navigate to this path “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager“
  • Rename the “PendingFileRenameOperations” value to “OldPendingFileRenameOperations“

Note: Don't reboot your machine after this registry hack because if you do then it will again create a key named "PendingFileRenameOperations" and you will be stuck in this vicious circle.

Credit: https://social.technet.microsoft.com/Forums/office/en-US/f29b066e-9cd5-4a71-9db1-77ba01e40173/a-system-restart-from-a-previous-installation-or-update-is-pending?forum=sharepointadmin

Saturday, February 6, 2016

Hide parameters in Report dialog Ax2012

There are different ways to do it. Some of them are:



Method 1:

Why the default ranges will come in Dialog?:

Because in the Query used it will show the index fields of the Table, so to hide the Default ranges you have to overload the showQueryValues() in the Controller class: return FALSE.

Credit: http://axdevhelper.blogspot.com/2012/09/how-to-hide-default-query-parameters-in.html


Method 2:

The View group fields comes from InventDimViewContract class which is added as a parm method in ProdPickListContract class to show the options for all inventory dimensions.

Suppose, we want to hide all the parameter groups from report dialog and just want to display the dynamics filters on the report. You need to modify the UIBuilder class of your report. For production picking list report, the UI Builder class is ProdPickListUIBuilder. The build method needs to be modified and the code in Bold below can be used to hide the whole parameter group from SSRS report dialog:

public void build()
{
FormBuildGroupControl grp;
grp = this.dialog().curFormGroup();
grp.frameType();
grp.columns(2);

if (this.controller().parmArgs().menuitemName() == #yourMenuItemName)
{
grp.visible(false);
}
super ();
}

To hide the dynamic filters from SSRS report dialog based on caller menu item, you need to override the following method in your controller class and return false from this method based on your condition:

showQueryValues

Override this method in your controller class and write the following code:

public boolean showQueryValues(str parameterName)
{
If (this.parmArgs().menuItemName() == menuItemOutputStr(#YourMenuItemName)
{
return false;
}
else
{
return true;
}
}

Credits: https://syedbaber.wordpress.com/2015/07/23/hiding-parameter-groups-or-dynamics-filters-on-ssrs-report-dialog-at-runtime/

Method 3:
If you use a report controler class, you can overwrite the showQuerySelectButton method and return false.


Method 4 :
If you remove the ranges from the modeled query, and add them back programmatically in the methods of the query, they also will not show up as parameters for the report.


Method 5:

contract parameters are can definately be hidden . Look at any report that uses srstmpTableMarshaller class (Pseudo tmp table report's ). or any document reports . Journal record id is generally passed from controller --> Design (via parameter value in contract class) -- >DP class.


But still it's not visible on the report. All you need to is set its property to hidden in VS.
I feel its more like issue with the usage data.
Once you set the property to hidden you need delete the report from report manager and then redeploy, remove usage data, delete records in SYSLastValue, SRSReportQuery restart Reporting services.

Method 6:

Allow dynamic filtering false and remove the dynamic parameter. redeploy the report and refresh the user cache.


Method 7:

You can also use a not defined group.
SysOperationGroupMemberAttribute(‘group_notdefined_at_classdeclaration’)

The group ‘group_notdefined….’ will not be shown on the dialog, so all its members are
invisible.

Credits: https://community.dynamics.com/ax/f/33/t/83017

https://community.dynamics.com/ax/f/33/p/155614/364546#364546


Now one of them would surely help :)